Closed Nominom closed 3 years ago
What is the difference between Marshal.SizeOf and Unsafe.SizeOf that makes Unsafe.SizeOf the "correct" way to do it?
They both produce the same result in most cases. Seems like Marshal.SizeOf is intended for when sending raw data between C# and C/C++, while Unsafe.SizeOf is for internal C# use. The "marshal" can add padding bytes sometimes if necessary. At least this is what I remember reading.
This was fixed in the latest commit already though.
This currently doesn't break anything but Unsafe.SizeOf is the correct way to do it.