C#的SizeOf使用
string s = string.Empty;
string ss = "";
Console.WriteLine(s.Length);
Console.WriteLine(ss.Length);
int a = 1;
Console.WriteLine(System.Runtime.InteropServices.Marshal.SizeOf(s)); //--引用类型的对象,不能使用该方法获得对象空间的大小
Console.WriteLine(System.Runtime.InteropServices.Marshal.SizeOf(a));
页:
[1]