Inheritance: ICustomTypeDescriptor
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }