本文整理匯總了C#中System.Web.UI.WebControls.Parameter.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# Parameter.GetType方法的具體用法?C# Parameter.GetType怎麽用?C# Parameter.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.UI.WebControls.Parameter
的用法示例。
在下文中一共展示了Parameter.GetType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetField
private string GetField(Parameter parameter)
{
var defaultPropertyAttribute = Attribute.GetCustomAttributes(parameter.GetType()).First(a => a is DefaultPropertyAttribute) as DefaultPropertyAttribute;
string field = null;
if (defaultPropertyAttribute != null && defaultPropertyAttribute.Name != "DefaultValue")
{
field = parameter.GetType().GetProperty(defaultPropertyAttribute.Name).GetValue(parameter, null) as string;
}
return field ?? parameter.Name;
}
示例2: GetParameterExpression
internal static string GetParameterExpression(IServiceProvider serviceProvider, Parameter p, System.Web.UI.Control control, out bool isHelperText)
{
if (p.GetType() == typeof(ControlParameter))
{
ControlParameter parameter = (ControlParameter) p;
if (parameter.ControlID.Length == 0)
{
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_ControlParameterExpressionUnknown");
}
string propertyName = parameter.PropertyName;
if (propertyName.Length == 0)
{
propertyName = GetControlDefaultValuePropertyName(parameter.ControlID, serviceProvider, control);
}
if (propertyName.Length > 0)
{
isHelperText = false;
return (parameter.ControlID + "." + propertyName);
}
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_ControlParameterExpressionUnknown");
}
if (p.GetType() == typeof(FormParameter))
{
FormParameter parameter2 = (FormParameter) p;
if (parameter2.FormField.Length > 0)
{
isHelperText = false;
return string.Format(CultureInfo.InvariantCulture, "Request.Form(\"{0}\")", new object[] { parameter2.FormField });
}
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_FormParameterExpressionUnknown");
}
if (p.GetType() == typeof(QueryStringParameter))
{
QueryStringParameter parameter3 = (QueryStringParameter) p;
if (parameter3.QueryStringField.Length > 0)
{
isHelperText = false;
return string.Format(CultureInfo.InvariantCulture, "Request.QueryString(\"{0}\")", new object[] { parameter3.QueryStringField });
}
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_QueryStringParameterExpressionUnknown");
}
if (p.GetType() == typeof(RouteParameter))
{
RouteParameter parameter4 = (RouteParameter) p;
if (parameter4.RouteKey.Length > 0)
{
isHelperText = false;
return string.Format(CultureInfo.InvariantCulture, "Page.RouteData(\"{0}\")", new object[] { parameter4.RouteKey });
}
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_RouteParameterExpressionUnknown");
}
if (p.GetType() == typeof(CookieParameter))
{
CookieParameter parameter5 = (CookieParameter) p;
if (parameter5.CookieName.Length > 0)
{
isHelperText = false;
return string.Format(CultureInfo.InvariantCulture, "Request.Cookies(\"{0}\").Value", new object[] { parameter5.CookieName });
}
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_CookieParameterExpressionUnknown");
}
if (p.GetType() == typeof(SessionParameter))
{
SessionParameter parameter6 = (SessionParameter) p;
if (parameter6.SessionField.Length > 0)
{
isHelperText = false;
return string.Format(CultureInfo.InvariantCulture, "Session(\"{0}\")", new object[] { parameter6.SessionField });
}
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_SessionParameterExpressionUnknown");
}
if (p.GetType() == typeof(ProfileParameter))
{
ProfileParameter parameter7 = (ProfileParameter) p;
if (parameter7.PropertyName.Length > 0)
{
isHelperText = false;
return string.Format(CultureInfo.InvariantCulture, "Profile(\"{0}\")", new object[] { parameter7.PropertyName });
}
isHelperText = true;
return System.Design.SR.GetString("ParameterEditorUserControl_ProfileParameterExpressionUnknown");
}
if (p.GetType() == typeof(Parameter))
{
Parameter parameter8 = p;
if (parameter8.DefaultValue == null)
{
isHelperText = false;
return string.Empty;
}
isHelperText = false;
return parameter8.DefaultValue;
}
//.........這裏部分代碼省略.........
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:101,代碼來源:ParameterEditorUserControl.cs