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

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

public GetSectionGroup ( string path ) : ConfigurationSectionGroup
path string
Результат ConfigurationSectionGroup
		public ConfigurationSectionGroup GetSectionGroup (string path)
		{
			string[] parts = path.Split ('/');
			ConfigurationSectionGroup group = SectionGroups [parts[0]];
			for (int n=1; group != null && n<parts.Length; n++)
				group = group.SectionGroups [parts [n]];
			return group;
		}
		

Usage Example

Пример #1
0
        public static void RemoveSettingsValues(this SystemConfiguration configuration, Type settingsClass, SettingScope?scope = null)
        {
            var removeApplicationSettings = !scope.HasValue || scope.Value == SettingScope.Application;
            var removeUserSettings        = !scope.HasValue || scope.Value == SettingScope.User;

            if (removeApplicationSettings)
            {
                var sectionPath = new ConfigurationSectionPath(settingsClass, SettingScope.Application);
                ConfigurationSectionGroup group = configuration.GetSectionGroup(sectionPath.GroupPath);
                if (group != null)
                {
                    group.Sections.Remove(sectionPath.SectionName);
                }
            }

            if (removeUserSettings)
            {
                var sectionPath = new ConfigurationSectionPath(settingsClass, SettingScope.User);
                var group       = configuration.GetSectionGroup(sectionPath.GroupPath);
                if (group != null)
                {
                    group.Sections.Remove(sectionPath.SectionName);
                }
            }

            configuration.Save(ConfigurationSaveMode.Minimal, true);
        }
All Usage Examples Of System.Configuration.Configuration::GetSectionGroup