On 11.05.2010 17:42, Brian Kesecker wrote:
>
> If the following evaluated (VB code):
>
> System.Runtime.InteropServices.Marshal.SizeOf(GetType(Char))
>
> A test application returns 1 running under Windows (specifically 32-bit 7
> Pro) and 2 running under Linux (specifically openSuSE 11.2 Mono 2.6.4).
> Logically, I would think that 2 should be correct, since Unicode characters
> are two bytes in size.  However, I'm thinking there may be something I'm
> missing, like a default project encoding option, or something to that
> effect.

I believe Marshal.SizeOf(typeof(char)) is returning
one for "orthogonality" with struct marshaling.

When part of a struct, a char will have the *unmanaged*
size of one by default because StructLayout.CharSet defaults
to Ansi for structs. See MSDN docs of Marshal.SizeOf.

Robert

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to