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

CreateSectionGroup() приватный Метод

private CreateSectionGroup ( System.Configuration.SectionGroupInfo parentGroup, string name, ConfigurationSectionGroup sec ) : void
parentGroup System.Configuration.SectionGroupInfo
name string
sec ConfigurationSectionGroup
Результат void
		internal void CreateSectionGroup (SectionGroupInfo parentGroup, string name, ConfigurationSectionGroup sec)
		{
			if (parentGroup.HasChild (name)) throw new ConfigurationException ("Cannot add a ConfigurationSectionGroup. A section or section group already exists with the name '" + name + "'");
			if (sec.Type == null) sec.Type = system.Host.GetConfigTypeName (sec.GetType ());
			sec.SetName (name);

			SectionGroupInfo section = new SectionGroupInfo (name, sec.Type);
			section.StreamName = streamName;
			section.ConfigHost = system.Host;
			parentGroup.AddChild (section);
			elementData [section] = sec;

			sec.Initialize (this, section);
		}
		

Usage Example

 public void Add(string name, ConfigurationSectionGroup sectionGroup)
 {
     config.CreateSectionGroup(group, name, sectionGroup);
 }