using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
public readonly Dictionary<int, string> list1;
list1 = new Dictionary<int, string>()
{{1, "one"}, {2, "two"}, };
public readonly Dictionary<int, string> list1 = new Dictionary<int, string>()
{{1, "one"}, {2, "two"}, {3, "thr"},};
public static void Main()
TestClass1 tc1 = new TestClass1();
TestClass2 tc2 = new TestClass2();
using (Stream s1 = new MemoryStream(), s2 = new MemoryStream())
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(s1, tc1);
formatter.Serialize(s2, tc2);
Console.WriteLine("tc1 size: " + s1.Length);
Console.WriteLine("tc2 size: " + s2.Length);