コード例 #1
0
ファイル: Class2.cs プロジェクト: annv2601/SoLieuBaoCao
        private static void SaveToDocumentFormat(T serializableObject, Type[] extraTypes, string path, IsolatedStorageFile isolatedStorageFolder)
        {
            using (TextWriter textWriter = ObjectXMLSerializer <T> .CreateTextWriter(isolatedStorageFolder, path))
            {
                XmlSerializer xmlSerializer = ObjectXMLSerializer <T> .CreateXmlSerializer(extraTypes);

                xmlSerializer.Serialize(textWriter, serializableObject);
            }
        }
コード例 #2
0
ファイル: Class2.cs プロジェクト: annv2601/SoLieuBaoCao
        private static T LoadFromDocumentFormat(Type[] extraTypes, string path, IsolatedStorageFile isolatedStorageFolder)
        {
            T result = default(T);

            using (TextReader textReader = ObjectXMLSerializer <T> .CreateTextReader(isolatedStorageFolder, path))
            {
                XmlSerializer xmlSerializer = ObjectXMLSerializer <T> .CreateXmlSerializer(extraTypes);

                result = (xmlSerializer.Deserialize(textReader) as T);
            }
            return(result);
        }