/// <summary> /// 从字符串加载配置节。此配置节不使用缓存 /// </summary> /// <param name="section">配置节的实例</param> /// <param name="sectionInfo">配置信息的字符串</param> /// <param name="sectionName">配置节名称</param> /// <param name="checkNullSection">如果配置节为空,是否抛出异常</param> /// <returns></returns> public static bool LoadSection(this ConfigurationSection section, string sectionInfo, string sectionName, bool checkNullSection = false) { sectionInfo.CheckStringIsNullOrEmpty("sectionInfo"); using (StringReader reader = new StringReader(sectionInfo)) { return(section.LoadSection(XmlReader.Create(reader), sectionName, checkNullSection)); } }