Personally i'm using the TextWriter version
Where DataItem is this (only used for serialization)Code:if (FileList.myFiles[0].Count > 0 && Global.bSerialEnable) { foreach (long key in FileList.myFiles[0].Keys) { tempdataitems.Add(new DataItem(key.ToString(), FileList.myFiles[0][key].ToString())); } XmlSerializer serializer = new XmlSerializer(typeof(List<DataItem>)); StringWriter sw = new StringWriter(); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", ""); serializer.Serialize(sw, tempdataitems, ns); string path = sMyPath + @"\data.bin"; File.WriteAllText(path, sw.ToString(), Encoding.Unicode); sw.Dispose(); }
FileList is a personnal class. sMyPath is my application pathCode:public class DataItem { public string Key; public string Value; public DataItem(string key, string value) { Key = key; Value = value; } public DataItem() { } }




Reply With Quote