System.Configuration.Configuration.GetSection C# (CSharp) Метод

GetSection() публичный Метод

public GetSection ( string path ) : ConfigurationSection
path string
Результат ConfigurationSection
		public ConfigurationSection GetSection (string path)
		{
			string[] parts = path.Split ('/');
			if (parts.Length == 1)
				return Sections [parts[0]];

			ConfigurationSectionGroup group = SectionGroups [parts[0]];
			for (int n=1; group != null && n<parts.Length-1; n++)
				group = group.SectionGroups [parts [n]];

			if (group != null)
				return group.Sections [parts [parts.Length - 1]];
			else
				return null;
		}
		

Usage Example

Пример #1
0
 public ConfigReader()
 {
     config__ = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     backupConfigHandler__ = (BackupConfigHandler)config__.GetSection("BackupConfig");
     editorCompilerConfigHandler__ = (EditorCompilerConfigHandler)config__.GetSection("EditorCompilerConfig");
     preferenceConfigHandler__ = (PreferenceConfigHandler)config__.GetSection("PreferenceConfig");
 }
All Usage Examples Of System.Configuration.Configuration::GetSection