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); } }
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); }