The Get, GetItem and GetProperty methods provide read access to configuration information.
The GetItem methods return configuration information as single configuration items (IConfigItem). They can only be used to retrieve singleton ConfigTypes. If more than one instance of this ConfigType exists (within the scope indicated by the Selector), the GetItem methods throw an exception.
Other methods exist to retrieve collections of configuration items (Get) or individual configuration properties (GetProperty).
This overload of the GetItem method accepts a selector in the form of an object.
[Visual Basic] Overloads Public Shared Function GetItem(String, Selector) As IConfigItem
[C#] public static IConfigItem GetItem(String, Selector);
[C++] public: static IConfigItem* GetItem(String*, Selector);
[JScript] public static function GetItem(String, Selector) : IConfigItem;
This overload of the GetItem method accepts a selector in string form. It attempts to create a Selector from this string.
[Visual Basic] Overloads Public Shared Function GetItem(String, String) As IConfigItem
[C#] public static IConfigItem GetItem(String, String);
[C++] public: static IConfigItem* GetItem(String*, String*);
[JScript] public static function GetItem(String, String) : IConfigItem;
This overload of the GetItem method accepts a selector in the form of an object and also accepts a set of flags indicating the desired level of service.
[Visual Basic] Overloads Public Shared Function GetItem(String, Selector, Integer) As IConfigItem
[C#] public static IConfigItem GetItem(String, Selector, int);
[C++] public: static IConfigItem* GetItem(String*, Selector, int);
[JScript] public static function GetItem(String, Selector, int) : IConfigItem;
This overload of the GetItem method accepts a selector in string form. It attempts to create a Selector from this string. It also accepts a set of flags indicating the desired level of service.
[Visual Basic] Overloads Public Shared Function GetItem(String, String, Integer) As IConfigItem
[C#] public static IConfigItem GetItem(String, String, int);
[C++] public: static IConfigItem* GetItem(String*, String*, int);
[JScript] public static function GetItem(String, String, int) : IConfigItem;
Note This example shows how to use one of the overloaded versions of GetItem. For other examples that may be available, see the individual overload topics.
[C#]
using System.Configuration.Core; using System; AppDomainConfigItem adc = (AppDomainConfigItem) ConfigManager.GetItem("AppDomain", "file://c:\\Program Files\\MyApplication\\config.cfg"); Console.WriteLine(adc.GlobalPath); Console.WriteLine(adc.PrivatePath); Console.WriteLine(adc.ShadowCopy);
ConfigManager Class | ConfigManager Members | System.Configuration Namespace