예제 #1
0
        /// <summary>
        /// Serializes the view collection to xml and puts the data into a file.
        /// </summary>
        /// <param name="entityCollection">The Entity View collection to serialize.</param>
        /// <param name="path">The Path to the destination file.</param>
        public static void SerializeXml <T>(VList <T> entityCollection, string path)
        {
            XmlSerializer ser = new XmlSerializer(entityCollection.GetType());
            StreamWriter  sw  = new StreamWriter(path);

            ser.Serialize(sw, entityCollection);
            sw.Close();
        }
예제 #2
0
        /// <summary>
        /// Serializes the <see cref="T:VList{T}"/> of view entities to XML
        /// </summary>
        /// <typeparam name="T">type to return</typeparam>
        /// <param name="entityCollection">VList of T type to return</param>
        /// <returns>string of serialized XML</returns>
        public static string SerializeXml <T>(VList <T> entityCollection)
        {
            XmlSerializer ser    = new XmlSerializer(entityCollection.GetType());
            StringBuilder sb     = new StringBuilder();
            TextWriter    writer = new StringWriter(sb);

            ser.Serialize(writer, entityCollection);
            writer.Close();
            return(sb.ToString());
        }