You can use sizeof(bool) but then you need to compile with the /unsafe
switch
and also place that unsafe code in an unsafe code block.
unsafe
{
Console.WriteLine(sizeof(bool));
}
PS
Specifying to compile with the unsafe switch can also be done from the
VS.NET IDE
under Project->[ProjectName] Properties...->Configuration Properties->Build
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Keating" <Br**********@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
Hi there,
i want to know size of managed bool (know it is 1byte according to
language
spec)
but how do i do it in code?
Marshal.Sizeof... isn't an option cause it returns 4 bytes, i.e. unmanaged
Boolean
what is correct syntax?
Thanks in advance
Brian