eightHundreds
6/23/2017 - 1:17 PM

获得对象的字节数

获得对象的字节数

long size = 0;
object o = new object();
using (Stream s = new MemoryStream()) {
    BinaryFormatter formatter = new BinaryFormatter();
    formatter.Serialize(s, o);
    size = s.Length;
}