System.ComponentModel.TypeDescriptor.GetReflectionType C# (CSharp) Method

GetReflectionType() private method

private GetReflectionType ( Type type ) : Type
type System.Type
return System.Type
        public static Type GetReflectionType(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            return NodeFor(type).GetReflectionType(type);
        }

Same methods

TypeDescriptor::GetReflectionType ( object instance ) : Type

Usage Example

Example #1
0
 protected Attribute GetDefaultAttribute(Type attributeType)
 {
     lock (internalSyncObject)
     {
         if (_defaultAttributes == null)
         {
             _defaultAttributes = new Hashtable();
         }
         if (_defaultAttributes.ContainsKey(attributeType))
         {
             return((Attribute)_defaultAttributes[attributeType]);
         }
         Attribute attribute      = null;
         Type      reflectionType = TypeDescriptor.GetReflectionType(attributeType);
         FieldInfo field          = reflectionType.GetField("Default", BindingFlags.GetField | BindingFlags.Public | BindingFlags.Static);
         if ((field != null) && field.IsStatic)
         {
             attribute = (Attribute)field.GetValue(null);
         }
         else
         {
             ConstructorInfo constructor = reflectionType.UnderlyingSystemType.GetConstructor(new Type[0]);
             if (constructor != null)
             {
                 attribute = (Attribute)constructor.Invoke(new object[0]);
                 if (!attribute.IsDefaultAttribute())
                 {
                     attribute = null;
                 }
             }
         }
         _defaultAttributes[attributeType] = attribute;
         return(attribute);
     }
 }
All Usage Examples Of System.ComponentModel.TypeDescriptor::GetReflectionType