This documentation is archived and is not being maintained.

ConfigurationUserLevel Enumeration

Used to specify which configuration file is to be represented by the Configuration object.

Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)

public enum ConfigurationUserLevel
public enum ConfigurationUserLevel
public enum ConfigurationUserLevel

 Member nameDescription
NoneGet the Configuration that applies to all users. 
PerUserRoamingGet the roaming Configuration that applies to the current user. 
PerUserRoamingAndLocalGet the local Configuration that applies to the current user. 

Use ConfigurationUserLevel to specify which configuration file is to be represented by the Configuration object returned by ConfigurationManager.OpenExeConfiguration and ConfigurationManager.OpenExeConfiguration.

Application configuration files are in the same directory as the application and have the same name, but with a .config extension. For example, the configuration file for C:\System\Public.exe is C:\System\Public.exe.config.

Applications use a global configuration that applies to all users, separate configurations that apply to individual users, and configurations that apply to roaming users.

The following example shows how to use the ConfigurationUserLevel enumeration. This example is part of a larger example to be found at ConfigurationManager.

// Show how to use ConnectionStrings.
static void DisplayConnectionStrings()
{

    // Get the ConnectionStrings collection.
    ConnectionStringSettingsCollection connections =
        ConfigurationManager.ConnectionStrings;

    Console.WriteLine();
    Console.WriteLine("Connection strings:");


    // Loop to get the collection elements.
    IEnumerator conEnum =
        connections.GetEnumerator();

    int i = 0;
    while (conEnum.MoveNext())
    {
        string name = connections[i].Name;
        string connectionString = connections[name].ConnectionString;
        string provider = connections[name].ProviderName;

        Console.WriteLine("Name:               {0}", name);
        Console.WriteLine("Connection string:  {0}", connectionString);
        Console.WriteLine("Provider:           {0}", provider);
    }

}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: