System.Net.Configuration.AuthenticationModulesSectionInternal.AuthenticationModulesSectionInternal C# (CSharp) Method

AuthenticationModulesSectionInternal() private method

private AuthenticationModulesSectionInternal ( AuthenticationModulesSection section ) : System.Configuration
section AuthenticationModulesSection
return System.Configuration
        internal AuthenticationModulesSectionInternal(AuthenticationModulesSection section)
        {
            if (section.AuthenticationModules.Count > 0)
            {
                this.authenticationModules = new List<Type>(section.AuthenticationModules.Count);
                foreach(AuthenticationModuleElement authenticationModuleElement in section.AuthenticationModules)
                {
                    Type type = null;

                    try
                    {
                        type = Type.GetType(authenticationModuleElement.Type, true, true);

                        // verify that its of the proper type of object
                        if (!typeof(IAuthenticationModule).IsAssignableFrom(type))
                        {
                            throw new InvalidCastException(SR.GetString(SR.net_invalid_cast, type.FullName, "IAuthenticationModule"));
                        }
                    }
                    catch (Exception exception)
                    {
                        if (NclUtilities.IsFatal(exception)) throw;

                        throw new ConfigurationErrorsException(SR.GetString(SR.net_config_authenticationmodules), exception);
                    }
                    catch
                    {
                        throw new ConfigurationErrorsException(SR.GetString(SR.net_config_authenticationmodules), new Exception(SR.GetString(SR.net_nonClsCompliantException)));
                    }

                    this.authenticationModules.Add(type);
                }
            }
        }
AuthenticationModulesSectionInternal