ProviderSettingsCollection Class
.NET Framework 3.5
Represents a collection of ProviderSettings objects.
Assembly: System.Configuration (in System.Configuration.dll)
The following code example shows how to iterate through the Providers property, which returns a ProviderSettingsCollection.
using System; using System.Collections; using System.Collections.Specialized; using System.Text; using System.Configuration; using System.Security.Permissions; namespace Samples.AspNet { // Shows how to use the ProviderSettings. public class UsingProviderSettings { [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] private static void GetProviderSettings() { // Get the application configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); ProtectedConfigurationSection pSection = config.GetSection("configProtectedData") as ProtectedConfigurationSection; ProviderSettingsCollection providerSettings = pSection.Providers; foreach (ProviderSettings pSettings in providerSettings) { Console.WriteLine( "Provider settings name: {0}", pSettings.Name); Console.WriteLine( "Provider settings type: {0}", pSettings.Type); NameValueCollection parameters = pSettings.Parameters; IEnumerator pEnum = parameters.GetEnumerator(); int i = 0; while (pEnum.MoveNext()) { string pLength = parameters[i].Length.ToString(); Console.WriteLine( "Provider ssettings: {0} has {1} parameters", pSettings.Name, pLength); } } } static void Main(string[] args) { GetProviderSettings(); } } }
System.Object
System.Configuration.ConfigurationElement
System.Configuration.ConfigurationElementCollection
System.Configuration.ProviderSettingsCollection
System.Configuration.ConfigurationElement
System.Configuration.ConfigurationElementCollection
System.Configuration.ProviderSettingsCollection
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.