<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0-rc.2.20475.5" />

ProviderCollection

Represents a collection of provider objects that inherit from ProviderBase.
using System.Collections; namespace System.Configuration.Provider { public class ProviderCollection : ICollection, IEnumerable { private readonly Hashtable _hashtable; private bool _readOnly; public ProviderBase this[string name] { get { return _hashtable[name] as ProviderBase; } } public int Count => _hashtable.Count; public bool IsSynchronized => false; public object SyncRoot => this; public ProviderCollection() { _hashtable = new Hashtable(10, StringComparer.OrdinalIgnoreCase); } public IEnumerator GetEnumerator() { return _hashtable.Values.GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { _hashtable.Values.CopyTo(array, index); } public virtual void Add(ProviderBase provider) { if (_readOnly) throw new NotSupportedException(System.SR.CollectionReadOnly); if (provider == null) throw new ArgumentNullException("provider"); if (provider.Name == null || provider.Name.Length < 1) throw new ArgumentException(System.SR.Config_provider_name_null_or_empty); _hashtable.Add(provider.Name, provider); } public void Remove(string name) { if (_readOnly) throw new NotSupportedException(System.SR.CollectionReadOnly); _hashtable.Remove(name); } public void SetReadOnly() { if (!_readOnly) _readOnly = true; } public void Clear() { if (_readOnly) throw new NotSupportedException(System.SR.CollectionReadOnly); _hashtable.Clear(); } public void CopyTo(ProviderBase[] array, int index) { ((ICollection)this).CopyTo((Array)array, index); } } }