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


C# ICustomTypeDescriptor.GetClassName方法代码示例

本文整理汇总了C#中ICustomTypeDescriptor.GetClassName方法的典型用法代码示例。如果您正苦于以下问题:C# ICustomTypeDescriptor.GetClassName方法的具体用法?C# ICustomTypeDescriptor.GetClassName怎么用?C# ICustomTypeDescriptor.GetClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICustomTypeDescriptor的用法示例。


在下文中一共展示了ICustomTypeDescriptor.GetClassName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDisplayName

        /// <summary>
        /// Gets the display name for a class. Looks for the <see cref="DisplayNameAttribute"/>
        /// attribute, and falls back to the class's name by default.
        /// </summary>
        /// <param name="descriptor">The class's type descriptor</param>
        /// <returns>The display name of the class</returns>
        internal static string GetDisplayName(ICustomTypeDescriptor descriptor)
        {
            var displayNameAttribute = descriptor.GetAttribute<DisplayNameAttribute>();
            if (displayNameAttribute != null && !String.IsNullOrEmpty(displayNameAttribute.DisplayName)) {
                return displayNameAttribute.DisplayName;
            }

            return descriptor.GetClassName().Split('.', '+').Last();
        }
开发者ID:fellowshiptech,项目名称:ft-iserve,代码行数:15,代码来源:DataAnnotationsModelBinder.cs

示例2: SimpleTableProvider

        public SimpleTableProvider(DataModelProvider modelProvider, ICustomTypeDescriptor descriptor)
            : base(modelProvider) {

            if (descriptor == null) {
                throw new ArgumentNullException("descriptor");
            }

            _descriptor = descriptor;
            Name = descriptor.GetClassName();
            DataContextPropertyName = String.Empty;
            InitializeColumns(descriptor.GetProperties());
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:12,代码来源:SimpleTableProvider.cs

示例3: BuildDataObject

        internal static object BuildDataObject(object dataObject, ICustomTypeDescriptor typeDescriptor, IDictionary inputParameters) {

            Dictionary<string, Exception> convertOrValidateExceptions = null;
            PropertyDescriptorCollection props = typeDescriptor.GetProperties();
            foreach (DictionaryEntry de in inputParameters) {
                string propName = (de.Key == null ? String.Empty : de.Key.ToString());
                PropertyDescriptor property = props.Find(propName, /*ignoreCase*/true);
                // NOTE: No longer throws when a property is not found or is read only.  This makes
                // Delete, Insert and Update operations more optimistic, allowing scenarios such as:
                // 1) Deletes and Updates after projecting data in the Selecting event.
                // 2) Deletes and Updates after selecting children of the data object type in the
                //    Selecting event.
                if ((property != null) && (!property.IsReadOnly)) {
                    try {
                        object value = BuildObjectValue(de.Value, property.PropertyType, propName);
                        property.SetValue(dataObject, value);
                    }
                    catch (Exception e) {
                        if (convertOrValidateExceptions == null) {
                            convertOrValidateExceptions = new Dictionary<string, Exception>(
                                StringComparer.OrdinalIgnoreCase);
                        }
                        convertOrValidateExceptions[property.Name] = e;
                    }
                }
            }

            // package up conversion or dlinq validation exceptions into single exception.
            if (convertOrValidateExceptions != null) {
                // Include the text of the first exception as part of the full exception,
                // to make it less cryptic in scenarios where it gets shown.
                throw new LinqDataSourceValidationException(String.Format(CultureInfo.InvariantCulture,
                    "AtlasWeb.LinqDataSourceView_ValidationFailed", typeDescriptor.GetClassName(), convertOrValidateExceptions.Values.First().Message),
                    convertOrValidateExceptions);
            }

            return dataObject;
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:38,代码来源:DataSourceUtilities.cs

示例4: ExtractTypeName

 private static string ExtractTypeName(ICustomTypeDescriptor typeDescriptor)
 {
     string name = typeDescriptor.GetClassName();
     if (string.IsNullOrEmpty(name))
     {
         return name;
     }
     int lastDot = name.LastIndexOf(".");
     return (lastDot >= 0) ? name.Substring(lastDot + 1) : name;
 }
开发者ID:olekongithub,项目名称:synctoday2015,代码行数:10,代码来源:TypeDescriptorXamlType.cs


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