Ejemplo n.º 1
0
        /// <summary>
        /// 读取信息集合
        /// </summary>
        /// <param name="info">信息</param>
        /// <returns></returns>
        public static List <T> LoadItems <T>(string info, PageContent objPage, Encoding encode)
        {
            MemoryStream stm    = new MemoryStream();
            StreamWriter writer = new StreamWriter(stm, encode);

            try
            {
                writer.Write(info);
                writer.Flush();
                List <T> lst = ListXMLExtends.ReadXML <T>(stm, objPage);
                return(lst);
            }
            finally
            {
                writer.Close();
                stm.Close();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 返回集合项的XML字符串
        /// </summary>
        /// <param name="items">集合项</param>
        /// <returns></returns>
        public static string ItemsToString(IList items, PageContent objPage, Encoding encode)
        {
            string       ret = null;
            MemoryStream stm = new MemoryStream();

            ListXMLExtends.WriteXml(items, stm, objPage, encode);
            StreamReader reader = new StreamReader(stm, encode);

            try
            {
                stm.Position = 0;
                ret          = reader.ReadToEnd();
            }
            finally
            {
                reader.Close();
                stm.Close();
            }
            return(ret);
        }