Tuesday, August 21, 2007

Is the boolean really 4 bytes long?

I read for some time ago ".NET FRAMEWORK 2.0 Application Developent Foundation" that the value type Boolean was 4 Bytes.
And I thought hey a boolean is only a byte of value 0 or 1, and thats only 1 byte!

So I Tried to write the size out and endeed it was 4 bytes : Console.WriteLine(System.Runtime.InteropServices.Marshal.SizeOf(typeof (Boolean)));

After that result, I googled for more info. And read that aBoolean value is a pure true or false value in C#
If any have a good explanation please blog it!!...

No comments:

Post a Comment