Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide
View Single Post
Mattias Sjögren's Avatar
Mattias Sjögren
Guest
n/a Posts
March 11th, 2006
09:45 AM
#3

Re: System.Boolean Question.
>today, i read msdn like usual, suddenly i found variable with type of[color=blue]
>System.Boolean should take up 2 Bytes. it surprised me a lot. why a
>boolean value should take up 2 bytes?[/color]

It doesn't, it takes one byte (the smallest size you can address). You
can check that yourself with sizeof(bool). Any MSND topics that says
otherwise are wrong. If you want to store a lot of boolean values with
just a single bit each, use a BitArray.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.