1
string s = "hello";
Console.WriteLine(Marshal.SizeOf(s)); // gives error
Marshal.Sizeof適用於其他數據類型,如int,char等,但不適用於字符串數據類型。有什麼具體的原因呢?爲什麼Marshal.Sizeof不適用於字符串?
string s = "hello";
Console.WriteLine(Marshal.SizeOf(s)); // gives error
Marshal.Sizeof適用於其他數據類型,如int,char等,但不適用於字符串數據類型。有什麼具體的原因呢?爲什麼Marshal.Sizeof不適用於字符串?
http://ericlippert.com/2013/06/13/whats-the-difference-sizeof-and-marshal-sizeof/ –
它甚至沒有對數組,bitArray和其他引用類型的工作。 – RBT