﻿// Decompiled with JetBrains decompiler
// Type: System.Configuration.SettingsProviderCollection
// Assembly: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 5ABD58FD-DF31-44FD-A492-63F2B47CC9AF
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll

using System;
using System.Configuration.Provider;
using System.Runtime;

namespace System.Configuration
{
  /// <summary>
  /// Represents a collection of application settings providers.
  /// </summary>
  /// <filterpriority>2</filterpriority>
  public class SettingsProviderCollection : ProviderCollection
  {
    /// <summary>
    /// Gets the settings provider in the collection that matches the specified name.
    /// </summary>
    /// 
    /// <returns>
    /// If found, the <see cref="T:System.Configuration.SettingsProvider"/> whose name matches that specified by the name parameter; otherwise, null.
    /// </returns>
    /// <param name="name">A <see cref="T:System.String"/> containing the friendly name of the settings provider.</param><exception cref="T:System.ArgumentNullException">The <paramref name="name"/> parameter is null.</exception><exception cref="T:System.NotSupportedException">The collection is read-only when setting this value.</exception><filterpriority>2</filterpriority>
    public SettingsProvider this[string name]
    {
      get
      {
        return (SettingsProvider) base[name];
      }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Configuration.SettingsProviderCollection"/> class.
    /// </summary>
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public SettingsProviderCollection()
    {
    }

    /// <summary>
    /// Adds a new settings provider to the collection.
    /// </summary>
    /// <param name="provider">A <see cref="T:System.Configuration.Provider.ProviderBase"/> to add to the collection.</param><exception cref="T:System.ArgumentException">The <paramref name="provider"/> parameter is not of type <see cref="T:System.Configuration.SettingsProvider"/>. -or-The <see cref="P:System.Configuration.Provider.ProviderBase.Name"/> property of the provider parameter is null or an empty string.-or-A settings provider with the same <see cref="P:System.Configuration.Provider.ProviderBase.Name"/> already exists in the collection.</exception><exception cref="T:System.NotSupportedException">The collection is read-only.</exception><exception cref="T:System.ArgumentNullException">The <paramref name="provider"/> parameter is null.</exception><filterpriority>2</filterpriority>
    public override void Add(ProviderBase provider)
    {
      if (provider == null)
        throw new ArgumentNullException("provider");
      if (!(provider is SettingsProvider))
        throw new ArgumentException(System.SR.GetString("Config_provider_must_implement_type", new object[1]
        {
          (object) typeof (SettingsProvider).ToString()
        }), "provider");
      base.Add(provider);
    }
  }
}
