GetConstructorWithReflectionPermission() private method

private GetConstructorWithReflectionPermission ( Type type, Type baseType, bool throwOnError ) : ConstructorInfo
type System.Type
baseType System.Type
throwOnError bool
return System.Reflection.ConstructorInfo
Esempio n. 1
0
            private void Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
            {
                // Get the type of the factory
                Type type = TypeUtil.GetTypeWithReflectionPermission(configRecord.Host, factoryRecord.FactoryTypeName, true);

                // If the type is a ConfigurationSection, that's the type.
                if (typeof(ConfigurationSection).IsAssignableFrom(type))
                {
                    _sectionCtor = TypeUtil.GetConstructorWithReflectionPermission(type, typeof(ConfigurationSection), true);
                }
                else
                {
                    // Note: in v1, IConfigurationSectionHandler is in effect a factory that has a Create method
                    // that creates the real section object.

                    // throws if type does not implement IConfigurationSectionHandler
                    TypeUtil.VerifyAssignableType(typeof(IConfigurationSectionHandler), type, true);

                    // Create an instance of the handler
                    _sectionHandler = (IConfigurationSectionHandler)TypeUtil.CreateInstanceWithReflectionPermission(type);
                }
            }