当前位置: 首页>>代码示例>>C#>>正文


C# Parameter.GetType方法代码示例

本文整理汇总了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;
        }
开发者ID:Nangal,项目名称:Glimpse,代码行数:11,代码来源:DataBoundControlAdapter.cs

示例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


注:本文中的System.Web.UI.WebControls.Parameter.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。