System.Buffer Class With Boolean Data Type

wfunction

Well-known member
Joined
Oct 31, 2006
Messages
46
Programming Experience
1-3
Does anyone know how to use the System.Buffer class with the Boolean data type? It makes no sense to set an element of a 1-bit data type using SetByte!!
Thanks.
 
Boolean data type is 1 byte, check for example with Buffer.ByteLength. Set the byte value to 0 for False, all other byte values for True.
 
Does anyone know how to use the System.Buffer class with the Boolean data type? It makes no sense to set an element of a 1-bit data type using SetByte!!
Thanks.
WHAAAT?!
I was writing my own BigInteger class which had an array of Booleans (not like the one in J# or Java), but that means that I'm using at least 8 times more memory than I thought!! Thanks a lot though!
Any ideas on how to improve performance?
Otherwise, my question has been answered. Thanks!
 
Maybe you could have a look into the BitArray class.
 
Thanks... I thought BitArray was implemented using a Boolean(), but I was wrong. However, a little question: are the lower and upper bounds ALWAYS 0 and Length - 1, or can they be changed by constructing using non-zero lower bound arrays?
 
arrays are zero-based:
In Visual Basic .NET, the lower bound of every array dimension is 0, and you cannot declare it to be otherwise.
 
Back
Top