public static void Main(String [] args) { Point p1 = new Point(2, 3); String str1 = MySerializer.Serialize(p1); Console.WriteLine(str1); Point newPt = MySerializer.Deserialize <Point>(str1); Console.WriteLine(newPt); }
public static void Main(String [] args) { Point p1 = new Point(2, 3); String str1 = MySerializer.Serialize(p1); Console.WriteLine(str1); Point newPt = MySerializer.Deserialize <Point>(str1); Console.WriteLine(newPt); Student s1 = new Student("Test Student", 3.5, false); String str2 = MySerializer.Serialize(s1); Console.WriteLine(str2); Student newSt = MySerializer.Deserialize <Student>(str2); Console.WriteLine(newSt); }
static void Main(string[] args) { var serializer = new MySerializer(); var stream = new MemoryStream(); var lst = new List <object>(); //var apple = new Apple<int>(Colour.Green, 4); //lst.Add(new int[,,] { { { 1, 2, 3 }, { 4, 5, 6 } }, { { 7, 8, 9 }, { 10, 11, 12 } } }); //lst.Add(apple); //lst.Add(ConsoleColor.Yellow); //lst.Add("abcd"); //lst.Add(4321); var x = new int[, , ] { { { 1, 2, 3 }, { 4, 5, 6 } }, { { 7, 8, 9 }, { 10, 11, 12 } } }; //Apple[] apples = new Apple[2] { new Apple(Colour.Yellow, 9), new Apple(Colour.Red, 10) }; var l = new LinkedList <Apple>(); var app1 = new Apple(Colour.Yellow, 9); var app2 = new Apple(Colour.Green, 7); var app3 = new Apple(Colour.Yellow, 5); var app4 = new Apple(Colour.Red, 8); var app5 = new Apple(Colour.Yellow, 2); var n1 = l.AddFirst(app1); var n2 = l.AddAfter(n1, app3); var n3 = l.AddBefore(n2, app2); var n4 = l.AddAfter(n3, app4); var n5 = l.AddAfter(n4, app5); Colour c = Colour.Yellow; var d = 2424.655; serializer.Serialize(l, stream); stream.Position = 0; var r = serializer.Deserialize(stream); }