PC Review


Reply
Thread Tools Rate Thread

BitArray vs. BitVector32

 
 
=?Utf-8?B?Y2hveWsx?=
Guest
Posts: n/a
 
      29th Jan 2005
Hi all,

I have several question about BitArray and BitVector32.

--------------------------------------------
1. Counting 'true' from BitArray items
--------------------------------------------
BitArray keys = new BitArray(32);
....
int a = 0;
for (int i = 0; i < keys.Count; i++)
a += (keys[i]) ? 1 : 0;

Should I apply loop like above?

----------------------------------------------------------------
2. The difference between Length and Count of BitArray
----------------------------------------------------------------
According to the MSDN:
Count - Gets the number of elements contained in the BitArray.
Length - Gets or sets the number of elements in the BitArray.

As we know, BitArray can expand or contract by changing Length: however, why
does this provide a readonly property, 'Count'? Are they different?

-----------------------------------------------------------------
3. Why doesn't BitVector32 implement bitwise operation?
-----------------------------------------------------------------
According to the MSDN:
'BitVector32 is more efficient than BitArray for Boolean values and small
integers that are used internally. A BitArray can grow indefinitely as
needed, but it has the memory and performance overhead that a class instance
requires. In contrast, a BitVector32 uses only 32 bits.'

Yes, that's cool. But Why no bitwise op. Instead, why does it have Mask and
Section? And why BitArray does not implement such cool Mask and Section?

------------------------------
4. Why only BitVector32...
------------------------------
I need BitVector64, BitVector128, and more.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BitArray -> int Alexander Vasilevsky Microsoft C# .NET 2 28th Nov 2011 05:25 AM
VB 2005 BitVector32 =?Utf-8?B?SGFucw==?= Microsoft Dot NET 5 19th May 2007 12:03 AM
Help: BitArray James Microsoft VB .NET 0 14th Nov 2005 05:11 PM
C# BitVector32 for DCB Struct - any help? =?Utf-8?B?Q2h1YSBXZW4gQ2hpbmc=?= Microsoft C# .NET 13 14th Jul 2004 02:38 PM
31 bits in a BitVector32 Leo Tohill Microsoft Dot NET Framework 2 19th Oct 2003 11:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 AM.