cqujsjcyj 发表于 2013-2-5 01:48:09

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]
查看完整版本: C#的SizeOf使用