c# .net serializes List

巴扎黑
Release: 2016-12-19 17:13:57
Original
2127 people have browsed it

/// <summary>
        /// 序列化List
        /// </summary>
        /// <param name="al"></param>
        /// <returns>string</returns>
        public string SerializeArrayList(ArrayList al)
        {
            Type[] extra = new Type[1];
            extra[0] = typeof(LocalNetInfo);
           // extra[0] = typeof(string);
            XmlSerializer xs = new XmlSerializer(typeof(ArrayList), extra);
            MemoryStream ms = new MemoryStream();
            XmlTextWriter tw = new XmlTextWriter(ms, Encoding.Default);
            xs.Serialize(tw, al);
            tw.Close();
            return Encoding.Default.GetString(ms.ToArray());
        }
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template