BN089-BS开发框架MVC4版/source20131023/Zephyr.Net/Zephyr.Utils/Document/Excel/ExcelLibrary/CodeLib/FileIO.cs

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace QiHe.CodeLib
{
    /// <summary>
    /// XmlFile load and save object from and to xml file;
    /// </summary>	
    public class XmlData<DataType>
    {
        /// <summary>
        /// Loads the specified xmlfile.
        /// </summary>
        /// <param name="xmlfile">The xmlfile.</param>
        /// <returns></returns>
        public static DataType Load(string xmlfile)
        {
            DataType data;
            Type datatype = typeof(DataType);
            XmlSerializer mySerializer = new XmlSerializer(datatype);
            if (File.Exists(xmlfile))
            {
                using (XmlTextReader reader = new XmlTextReader(xmlfile))
                {
                    data = (DataType)mySerializer.Deserialize(reader);
                }
            }
            else
            {
                //throw new FileNotFoundException(xmlfile);
                return default(DataType);
            }
            return data;
        }
        /// <summary>
        /// Loads the specified xmldata.
        /// </summary>
        /// <param name="xmldata">The xmldata.</param>
        /// <returns></returns>
        public static DataType Load(Stream xmldata)
        {
            using (XmlTextReader reader = new XmlTextReader(xmldata))
            {
                XmlSerializer mySerializer = new XmlSerializer(typeof(DataType));
                return (DataType)mySerializer.Deserialize(reader);
            }
        }
        /// <summary>
        /// Loads the specified xmlfile.
        /// </summary>
        /// <param name="xmlfile">The xmlfile.</param>
        /// <param name="root">The root.</param>
        /// <returns></returns>
        public static DataType Load(string xmlfile, string root)
后面还有 361 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。