Наследование: ICustomTypeDescriptor
Пример #1
0
        public static void AddGenericProviderToType(Type type)
        {
            if (type == null) throw new ArgumentNullException("type");
            if (providers.ContainsKey(type))
                return;

            var previousProvider = TypeDescriptor.GetProvider(type);
            var typeDescriptor = new GenericTypeDescriptor(type, previousProvider.GetTypeDescriptor(type));
            var newProvider = new GenericTypeDescriptionProvider(typeDescriptor);

            TypeDescriptor.RemoveProvider(previousProvider, type);
            TypeDescriptor.AddProvider(newProvider, type);
        }
Пример #2
0
        public static void AddGenericProviderToType(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (providers.ContainsKey(type))
            {
                return;
            }

            var previousProvider = TypeDescriptor.GetProvider(type);
            var typeDescriptor   = new GenericTypeDescriptor(type, previousProvider.GetTypeDescriptor(type));
            var newProvider      = new GenericTypeDescriptionProvider(typeDescriptor);

            TypeDescriptor.RemoveProvider(previousProvider, type);
            TypeDescriptor.AddProvider(newProvider, type);
        }