Answers for "calculate how much memory an object take c#"

C#
0

calculate how much memory an object take c#

long size = 0;
object o = new object();
using (Stream s = new MemoryStream()) {
    BinaryFormatter formatter = new BinaryFormatter();
    formatter.Serialize(s, o);
    size = s.Length;
}
Posted by: Guest on December-23-2020

Code answers related to "calculate how much memory an object take c#"

C# Answers by Framework

Browse Popular Code Answers by Language