0 out of 2 rated this helpful - Rate this topic

Marshal.SizeOf Method

Returns the unmanaged size, in bytes, of a class using Marshal.

Name Description
Marshal.SizeOf (Object) Returns the unmanaged size of an object in bytes.

Supported by the .NET Compact Framework.

Marshal.SizeOf (Type) Returns the size of an unmanaged type in bytes.

Supported by the .NET Compact Framework.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Warning with System.Char
The unmanaged size of a type isn't necessarily the same as the managed size
Therefore, this method works great when you need to communicate the size of a type to unmanaged code, but the result may not be the same as using sizeof in C#, for example.