diff --git a/Sources/Persistance/DataContractSerializer.cs b/Sources/Persistance/DataContractSerializer.cs index 54cd379..2faf35e 100644 --- a/Sources/Persistance/DataContractSerializer.cs +++ b/Sources/Persistance/DataContractSerializer.cs @@ -10,6 +10,25 @@ namespace Persistance { public class DataContractSerializer { + public Theque DataContractSerializer() + { + Theque theque = new Theque(); + Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory())); + string xmlFile = "theque.xml"; + + var serializer = new DataContractSerializer(typeof(Theque)); + + using (Stream s = File.Create(xmlFile)) + { + serializer.WriteObject(s, theque); + } + + Theque theque2; + using (Stream s = File.OpenRead(xmlFile)) + { + theque2 = serializer.ReadObject(s) as Theque; + } + } } } \ No newline at end of file