Example #1
0
        public void Test()
        {
            CustomSection customSection = CustomSection.GetCustomSection();

            customSection.Name  += "name ";
            customSection.Value += "value ";
            customSection.Save();
        }
Example #2
0
        public static CustomSection GetCustomSection()
        {
            Configuration config  = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            CustomSection section = config.Sections["CustomSection"] as CustomSection;

            if (section == null)
            {
                section = new CustomSection(config);
                config.Sections.Add("CustomSection", section);
            }
            return(section);
        }