Monday, June 15, 2009

Chapter 4-Lesson 4

  • BitArray class stores Boolean values in a resizable list. (Manually resizable using Length property)
  • This class also supports standard operations such as AND, OR, XOR, etc.
  • BitVector32 is a structure. It is not resizable, and is used to manipulate bits of, say an Int32.
  • BitArray does not support Add( ) / Remove( ) methods. We use indexers instead.
  • BitVector32 structure actually stores its value in its Data property which is an Int32. Any changes made to the bits would ultimately change the Data property.
  • BitVector32 works on unsigned integers.
  • Practical usage of BitVector32 include Bit Masking, Bit Packing, etc.
  • Bit Packing allows storage of usual small numbers into one relatively large number to save space. (e.g. instead of using three Int16 numbers, we may pack them into one Int32)
  • StringCollection and StringDictionary are strongly typed.
  • StringCollection works identical to ArrayList, and StringDictionary works identical to HashTable except that both Key and Value must be strings.
  • However, Keys in StringDictionary are case-Insensitive, meaning "fourth" and "Fourth" would lead to same Value.
  • The CollectionsUtil class provides static methods for creating case-insensitive HashTable/SortedList.
  • StringComparer object allows for creating Culture-Invariant collections.
  • The NameValueCollection allows to store multiple Values per Key. Values can be retrieved by using Key or Index.
  • This collection would behave like previous collections when items are added using indexer, but behaves differently (allows multiple Values per Key) when Add( ) method is used.
  • It also supports retriving Value using Index number of Key. If a key has more than one Value, using index would return a comma seperated list.

No comments:

Post a Comment