DotNetBlog der DotNet-Blog Alles rund um Microsoft .NET – von  Sascha H. Baumann

MCTS Exam 70-536 – Collections and Dictionaries

1 Star2 Stars3 Stars4 Stars5 Stars (Noch nicht bewertet. Seien Sie der/die Erste !)
Loading ... Loading ...

Good morning,

today I start with Collections and Dictionaries during my MCTS exam-preparation. As usual I provide my notes on that topic as a little help and motivation for other students.

Collections

  • namespaces where we find Collections are System.Collections and System.Collections.Specialized
  • Collectionstypes are:
    1. ArrayList – stores any type of object, expands as required. Accessable by zero based index or within a foreach_loop. Use .Add, .AddRange, .Remove, .Insert and .Sort (Objects need to implement IComparable), .Reverse (Reverse current order)
    2. Queue – First in, First out (FIFO) collection. Use .Enqueue and .Dequeue to add and remove objects and .Peek to lookup an object on a specified position. Use .Clear to remove all objects
    3. Stack – Last in, First out (LIFO) collection. Use .Push and .Pop to add and remove objects and .Peek to loopup an object on a specified position. Use .Clear to remove all objects
    4. StringCollection – As ArrayList, but strongly typed for strings, does not support sorting
    5. BitArray / BitVector – Collection of boolean values. BitVector is limited to 32 bits, BitArray stores more.
  • Thinking about IComparable, the method .CompareTo provides default sortorder while .Compare provides custom sortorder.
  • Dictionaries

  • Dictionary-Types are:
    1. Hashtable – name/value pairs that can be retrieved by name and index
    2. SortedList – sorted automatically by key. Array of DictionaryEntry objects
    3. StringDictionary – Hashtable that is strongly typed to string
    4. ListDictionary – Dictionary optimized for less then 10 items
    5. HybridDictionary – Advantage of ListDictionary when less then 10 items, otherwise behaves like a Hashtable
    6. NameValueCollection – pairs of strings, accessable by index or name(key). Can store multiple values for the same key.
  • Share and Enjoy:
    • Digg
    • del.icio.us
    • Mixx
    • Google Bookmarks
    • MisterWong.DE
    • Technorati
    • Webnews.de
    • YahooMyWeb

    Hinterlasse eine Antwort

    CAPTCHA-Bild CAPTCHA Audio
    Bild neuladen

    Bad Behavior has blocked 35 access attempts in the last 7 days.