ElementInformation.Source Property
.NET Framework (current version)
Gets the source file where the associated ConfigurationElement object originated.
Assembly: System.Configuration (in System.Configuration.dll)
Property Value
Type: System.StringThe source file where the associated ConfigurationElement object originated.
A ConfigurationElement object may be created in a default state, in which case this property returns null.
The following example shows how to use the Source property.
static public void GetElementSource() { // Get the current configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); // Get the section. UrlsSection section = (UrlsSection)config.GetSection("MyUrls"); // Get the element. UrlConfigElement url = section.Simple; // Get the element source file. string sourceFile = url.ElementInformation.Source; Console.WriteLine("Url element source file: {0}", sourceFile); }
.NET Framework
Available since 2.0
Available since 2.0
Show: