Marshal.SizeOf Method
.NET Framework 2.0
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. |
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.
- 6/8/2006
- Adam_Nathan