Пример #1
0
        /// <summary>
        /// 自xml文件读取对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="filePath"></param>
        /// <param name="nodePath"></param>
        /// <returns></returns>
        public static T Deserialize <T>(string filePath, string nodePath = null) where T : class, new()
        {
            XmlHelper xmlHelper = new XmlHelper(filePath);

            return(xmlHelper.DeserializeNode <T>(nodePath));
        }
Пример #2
0
        /// <summary>
        /// 自xml文件读取对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="filePath"></param>
        /// <param name="nodePath"></param>
        /// <returns></returns>
        public static IEnumerable <T> DeserializeCollection <T>(string filePath, string nodePath = null) where T : class, new()
        {
            XmlHelper xmlHelper = new XmlHelper(filePath);

            return(xmlHelper.DeserializeNodeCollection <T>(nodePath));
        }