static void Main(string[] args) { //Binary serialization string pathCar = "D://Car_SerializationFile.txt"; Car car = new Car(); Car car2 = null; Binary_Serializer.Serialize(pathCar, car); Binary_Serializer.Deserialize(pathCar, ref car2); Console.WriteLine("[Car]\nModel: {0}\n", car2.model); //=== //Xml serialization string pathPerson = "D://Person_SerializationFile.xml"; Person person = new Person(); Person person2 = null; Xml_Serializer.Serialize(pathPerson, person); Xml_Serializer.Deserialize(pathPerson, ref person2); Console.WriteLine("[Person]\nName: {0}\nAge: {1}", person2.name, person2.age); //=== Console.ReadKey(); }
static void Main(string[] args) { Tracer tr = new Tracer(); Foo f = new Foo(tr); f.MyMethod(); SomeClass sc = new SomeClass(tr); Thread th2 = new Thread(new ThreadStart(sc.NewMethod)); th2.Start(); th2.Join(); TraceResult trR = tr.GetTraceResult(); ConsoleWritter consoleWritter = new ConsoleWritter(); Json_Serializer json = new Json_Serializer(); consoleWritter.Write(json.Serialize(trR)); Xml_Serializer xml = new Xml_Serializer(); consoleWritter.Write(xml.Serialize(trR)); }