using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; public class Test { public static void Main() { List lista = new List(); for(Int32 i = 0; i < 100000; ++i) { lista.Add(i); } Dictionary map = new Dictionary(); for(Int32 i = 0; i < 100000; ++i) { map.Add(i, true); } long listSize = 0; long mapSize = 0; using (Stream s = new MemoryStream()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(s, lista); listSize = s.Length; } using (Stream s = new MemoryStream()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(s, map); mapSize = s.Length; } Console.WriteLine(String.Format("Lista: {0} bytes", listSize)); Console.WriteLine(String.Format("Mapa: {0} bytes", mapSize)); } }