long totalSessionBytes;
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter b = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.MemoryStream m = new System.IO.MemoryStream();
b.Serialize(m, UserData);
totalSessionBytes = m.Length;
Of course, there are some profilers that can be used such as the following:
- CLR Profiler
- Eqatec