Пример #1
0
        public static string GetValue(string MainSection, string sn)
        {
            string res = "";

            try
            {
                if (config.Sections[MainSection] == null)
                {
                    section.SectionInformation.AllowExeDefinition = ConfigurationAllowExeDefinition.MachineToApplication;
                    config.Sections.Add(MainSection, section);
                }
                else
                {
                    section = (AppSettingsSection)config.Sections[MainSection];
                }

                res = section.Settings[sn].Value;
            }
            catch (Exception e)
            {
                CLog.Write("CCofig->GetValue  " + e.GetAllMessages());
            }
            return(res);
        }