www.it-ebooks.info www.it-ebooks.info Developer’s Guide to Collections in Microsoft NET ® Calvin Janes www.it-ebooks.info Published with the authorization of Microsoft Corporation by: O’Reilly Media, Inc 1005 Gravenstein Highway North Sebastopol, California 95472 Copyright © 2011 by Calvin Janes All rights reserved No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher ISBN: 978-0-7356-5927-8 LSI Printed and bound in the United States of America Microsoft Press books are available through booksellers and distributors worldwide If you need support related to this book, email Microsoft Press Book Support at mspinput@microsoft.com Please tell us what you think of this book at http://www.microsoft.com/learning/booksurvey Microsof t and the trademarks listed at http://www.microsoft.com/about/legal/en/us/ IntellectualProperty/Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies All other marks are property of their respective owners The example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious No association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred This book expresses the author’s views and opinions The information contained in this book is provided without any express, statutory, or implied warranties Neither the authors, O’Reilly Media, Inc., Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book Acquisitions and Developmental Editor: Russell Jones Production Editor: Holly Bauer Editorial Production: Online Training Solutions, Inc Technical Reviewer: Chris G Williams Copyeditor: Jaime Odell, Online Training Solutions, Inc Proofreader: Victoria Thulman, Online Training Solutions, Inc Indexer: Ron Strauss Cover Design: Twist Creative • Seattle Cover Composition: Karen Montgomery Illustrator: Jeanne Craver, Online Training Solutions, Inc www.it-ebooks.info Contents at a Glance Part I Collection Basics Understanding Collections: Arrays and Linked Lists Understanding Collections: Associative Arrays 87 Understanding Collections: Queues, Stacks, and Circular Buffers 153 Part II .NET Built-in Collections Generic Collections 215 Generic and Support Collections 283 Part III Using Collections NET Collection Interfaces Introduction to LINQ Using Threads with Collections Serializing Collections Part IV Using 345 441 469 513 Collections with UI Controls 10 Using Collections with Windows Form Controls 539 11 Using Collections with WPF and Silverlight Controls 583 www.it-ebooks.info iii www.it-ebooks.info Table of Contents Introduction xiii Part I Collection Basics Understanding Collections: Arrays and Linked Lists Array Overview Uses of Arrays Advantages of Arrays Disadvantages of Arrays Array Implementation Understanding Indexing Getting Started Creating Constructors Allowing Users to Add Items 10 Allowing Users to Remove Items 13 Adding Helper Methods and Properties 17 Using the ArrayEx(T) Class 23 Linked List Overview 27 Uses of Linked Lists 27 Advantages of Linked Lists 27 Disadvantages of Linked Lists 28 Linked List Implementation 28 Singly Linked List Implementation 28 Doubly Linked List Implementation 54 Using an Array to Create a Linked List 81 Using the Linked List Class 81 Summary 85 What you think of this book? We want to hear from you! Microsoft is interested in hearing your feedback so we can continually improve our books and learning resources for you To participate in a brief online survey, please visit: microsoft.com/learning/booksurvey www.it-ebooks.info v vi Table of Contents Understanding Collections: Associative Arrays 87 Associative Array Overview 87 Uses of Associative Arrays 87 Advantages and Disadvantages of Associative Arrays 88 Associative Array Implementation 88 Using Association Lists for Associative Arrays 88 Using Hash Tables for Associative Arrays 105 Using the Associative Array Class 147 Summary 152 Understanding Collections: Queues, Stacks, and Circular Buffers 153 Queue Overview 153 Uses of Queues 153 Queue Implementation 153 Using an Array to Implement a Queue 154 Using a Linked List to Implement a Queue 163 Using the Queue Classes 170 Stack Overview 175 Uses of Stacks 175 Stack Implementation 175 Adding the Common Functionality 175 Using an Array to Implement a Stack 177 Using a Linked List to Implement a Stack 182 Using the Stack Classes 187 Circular Buffer Overview 193 Uses of Circular Buffers 193 Circular Buffer Implementation 194 Getting Started 194 Understanding the Internal Storage 195 Creating Constructors 198 Allowing Users to Add Items 201 Allowing Users to Remove Items 203 Adding Helper Methods and Properties 205 Changing Capacity 207 Using the CircularBuffer(T) Class 210 Summary 211 www.it-ebooks.info Table of Contents Part II .NET Built-in Collections Generic Collections 215 Understanding the Equality and Ordering Comparers 215 Understanding the Equality Comparer 215 Understanding the Ordering Comparer 218 Understanding Delegates, Anonymous Methods, and Lambda Expressions 219 Lambda Expressions in Visual Basic 221 List(T) Overview 222 Using the List(T) Class 222 Creating a List(T) 222 Appending Items to a List(T) 223 Traversing a List(T) 224 Removing Items from a List(T) 228 Inserting Items into a List(T) 230 Sorting a List(T) 231 Searching a List(T) 247 Checking the Contents of a List 263 Modifying the List 269 LinkedList(T) Overview 272 Using the LinkedList(T) Class 273 Creating a New LinkedList(T) 273 Adding to the LinkedList(T) 273 Removing Nodes from the LinkedList(T) 277 Obtaining Information on the LinkedList(T) 279 Summary 281 Generic and Support Collections 283 Queue(T) Overview 283 Using the Queue(T) Class 283 Creating a Queue 284 Adding Items to the Queue 285 Removing Items from the Queue 285 Checking the Queue 286 Cleaning the Queue 287 Stack(T) Overview 288 www.it-ebooks.info vii viii Table of Contents Using the Stack(T) Class 288 Creating a Stack 288 Adding Items to the Stack 289 Removing Items from the Stack 290 Checking the Stack 291 Cleaning the Stack 292 Dictionary(TKey,TValue) Overview 292 Understanding Dictionary(TKey,TValue) Implementation 293 Using the Dictionary(TKey,TValue) Class 293 Creating a Dictionary 294 Adding Items to a Dictionary 297 Removing Items from a Dictionary 298 Retrieving Values from the Dictionary by Using a Key 299 Checking the Dictionary 301 BitArray Overview 306 Using the BitArray Class 306 Creating a BitArray 306 Accessing Bits in the BitArray Class 308 Using the BitArray Class for Bit Operations 310 CollectionBase and DictionaryBase Overview 316 Using CollectionBase 317 Using DictionaryBase 324 HashSet(T) Overview 329 Using the HashSet(T) Class 329 Creating a HashSet(T) 329 Adding Items to the HashSet(T) 330 Removing Items from a HashSet(T) 331 Performing Set Operations on a HashSet(T) 333 Sorted Collections Overview 339 SortedList(TKey, TValue) 339 SortedDictionary(TKey, TValue) 339 Summary 341 www.it-ebooks.info 612 associative arrays associative arrays (continued) Associative Array class, using, 147–152 defined, 87 serializing, 528–531 synchronization support for, 512 use of, 87 using hash tables for See hash tables for associative arrays AutoResetEvent, 478 AverageArray method, 491, 494–495, 497 Average method (LINQ queries), 448 B BinarySearch methods, 222, 247, 259–263 binding with BindingSource object, 581–582 BindingListCollectionView, 597–598, 605 BindingList(T) class, 574 BindingList(T) in NET Framework, 541 BindingSource class, 575–576 with CollectionView class, 605–608 with ComboBox control, 576–577, 598–599 with DataGridView control and IBindingList, 578–580 with DataGridView control and IBindingListView, 580 with IBindingList, 578–580 with ListBox control, 577–578, 600–601 with ListView control, 601–602 with TreeView control, 603–605 BitArray class accessing bits in, 308–310 And method, 313–314 BitArray And(BitArray value), 313–314 BitArray Not(), 313 BitArray Or(BitArray value), 314 creating BitArrays, 306–307 Not method, 313 Or method, 314–315 overview, 306 using, 306 using for bit operations, 310–313 Xor method, 314–315 bitwise equality, 216–218 bool Add(T item), 330 bool ContainsKey(TKey key), 301 bool Contains(T item), 265–266, 287–288, 291, 338 bool Contains(T value), 281 bool ContainsValue(TValue value), 302–303 bool Exists(Predicate(T) match), 266–267 bool Get(int index), 309 bool IsProperSubsetOf(IEnumerable(T) other), 333–334 bool IsSubsetOf(IEnumerable(T) other), 335 bool IsSupersetOf(IEnumerable(T) other), 336 bool Item[int index] {get; set; }, 309 bool Overlaps(IEnumerable(T) other), 336–337 bool Remove(LinkedListNode(T) node), 277–278 bool Remove(T item), 228, 331–332 bool Remove(TKey key), 298 bool Remove(T value), 277 bool TrueForAll(Predicate(T) match), 267–269 buckets hash table, 106–107 picking number of, 113–116 sharing nodes across, 117–118 C cafeteria plates simulation (example) creating variables and plate stack, 188 customer in line receiving plate, 191–193 eating on/carrying plates to be cleaned, 189–190 looping application pending key press, 188–189 Plate class, defining, 187–188 plates being cleaned, 190–191 CalculateCapacity method, 130 CalculateHashCode method, 136 CanCastToT method, 431, 433 CancelNew implementation, 543 capacity Capacity property, 9, 17–22 of circular buffers, changing, 207–209 of lists, modifying, 228 setting to Count, 524 chaining (hash tables), 110–111 checking dictionaries, 301–304 stacks, 291–292 circular buffers adding helper methods/properties to CircularBuffer(T) class, 205–207 allowing users to add items to CircularBuffer(T) class, 201–203 allowing users to remove items from CircularBuffer(T) class, 203–204 changing capacity of, 207–209 CircularBuffer(T) class, using See song request line simulator example using CircularBuffer(T) constructors, creating in CircularBuffer(T) class, 198–200 defined, 193 implementing in CircularBuffer(T) class, 194–196 internal storage, 195–198 uses of, 193 CircularBuffer(T) class adding collection support to, 401–403 enumeration support for, 355–360 C# language, This keyword in, 20 classes adding collection support to See see collection support, adding to classes adding enumeration support to See enumeration support, adding to classes adding IList(T)/IList support to See IList(T)/IList support, adding to classes adding Key/Value pair support to, 435 cleaning stacks, 292 www.it-ebooks.info Count method ClearedItems property, 319 Clear method associative arrays and, 131 associative lists and, 95 calling in BindingSource, 575 CircularBuffer(T) class and, 204 in doubly linked lists, 74 HashSet(T) class and, 331 linked lists and, 277 QueuedLinkedList(T) class and, 167 Queue(T) class and, 285 to remove items from lists, 228 to remove items from stacks, 290–291 to remove keys and values from dictionaries, 298–299 to remove nodes from lists, 48 to remove items from ArrayEx(T) class, 13 CollectionBase class OnClear/OnClearComplete methods, 318–319 OnInsert/OnInsertComplete methods, 319–323 OnRemove/OnRemoveComplete methods, 321–322 OnSet/OnSetComplete methods, 323–324 OnValidate method, 317–318 overview, 317 CollectionChanged events, 583, 595–596 collections collection classes, 480 collection initialization, 453 enumerating over while changing, 511 serializing See serializing collections synchronized collection classes, 511–512 using in WPF and Silverlight, 583 using threads with See threads using with Window Forms See Windows Forms collection support, adding to classes ArrayEx(T) class, 398–400 AssociativeArrayAL(TKey,TValue) class, 417–422 AssociativeArrayHT(TKey,TValue) class, 422–427 CircularBuffer(T) class, 401–403 DoubleLinkedList(T) class, 403–408 overview, 398 QueudLinkedList(T) class, 411–413 QueuedArray(T) class, 408–410 SingleLinkedList(T) class, 403–408 StackedArray(T) class, 412–414 StackedLinkedList(T) class, 415–418 CollectionView class, binding with, 605–608 collisions, hash table, 107–109 ComboBox control binding with, 576–577, 598–599 setting DisplayMember property of, 539–540 CompareExchange method, 482 Compare function (sorting), 555 Compare method, 245 CompareTo(T) method, 218 Comparison(T) method (sorting), 236 constructors ArrayEx(T) class, 8–10 AssociativeArrayAL(T) class, 91–92 AssociativeArrayHT(T) class, 122–123 BitArray(Boolean[] values), 307 BitArray(Byte[] bytes), 307–308 BitArray(Int32 length), 308 BitArray(Int32 length, Boolean defaultValue), 307 BitArray(Int32[] values), 308 CircularBuffer(T) class, 198–200 creating in QueuedArray(T) class, 155–157 creating in QueuedLinkedList(T) class, 164–165 Dictionary(TKey, TValue)(), 294 Dictionary(TKey, TValue)(IDictionary(TKey, TValue) dictionary), 294–296 Dictionary(TKey, TValue)(IEqualityComparer(TKey) comparer), 295–296 Dictionary(TKey, TValue)(int capacity), 296 Dictionary(TKey, TValue)(int capacity, IEqualityComparer(TKey) comparer), 296 DoubleLinkedList(T) class, 59–60 LinkedList(T), 273 LinkedList(T)(IEnumerable(T) collection), 273 List(T) class, 222 Queue(T)(), 284 Queue(T)(IEnumerable(T)), 284 Queue(T)(int size), 284 SingleLinkedList(T) class, 33–34 StackedArray(T) class, 178–179, 183–184 Stack(T), 288 Stack(T)(IEnumerable(T)), 288–289 Stack (T)(int size), 289 ContainsKey method for checking dictionaries, 301 for discovering keys/values in collections, 101, 141 Contains method to allow users to view array contents, 17–22 to check for items in lists, 50 in checking list contents, 265–266 default equality comparer and, 222 to discover items in stacks, 291 in doubly linked lists, 76–77 HashSet(T) class, 338 in queues, 159 linked lists, 279 QueuedLinkedList(T) class, 167 Queue(T) class, 287–288 to view contents of lists, 49–50 ContainsValue method to check for keys/values in collections, 101, 141 for checking dictionary values, 302 contents of lists, checking, 263–269 ConvertAll method, 269 coprime multiplier, 113 copying contents of internal arrays, 53, 79 CopyTo method, 400, 406–408 Count method LINQ queries and, 448 setting Capacity to, 524 www.it-ebooks.info 613 614 Count property Count property ArrayEx(T) classes, 17–22 association lists, 98 associative arrays, 136 doubly linked lists, 60 example, 49–50 for returning key value pairs in dictionaries, 303 for returning number of items in stacks, 292–293 linked lists, 279 passing to Array.Copy method, 400 QueuedLinkedList(T) class, 167 in queues, 159 for returning number of items in queues, 287 count variable (circular buffers), 197 CurrentReadCount property, 497 D data breaking up with hash table buckets, 106–107 serializing/deserializing, 520–521 serializing to memory, 515–516 data binding simple (Window Forms), 539–540 two-way See two-way data binding DataGridView, 541, 543 DataGridViewAdvanceBinding form, 580 DataGridView control and IBindingList, binding with, 578–580 and IBindingListView, binding with, 580 data sources DataSource property (ListBox control), 539 picking (from clause), 453–458 used with LINQ, 442–443 deadlocking, 485–486 DebuggerDisplayAttribute, DebuggerTypeProxyAttribute, default equality comparison, 215 DefaultIfEmpty method, 466 default ordering comparer, 218 default Person structure (searching lists), 250–251 delegates, defined, 219 Dequeue method, 158, 166, 286–287 Deserialize method, 516 DevGuideToCollections project, DictionaryBase class OnClear/OnClearComplete methods, 325 OnGet method, 325 OnInsert/OnInsertComplete methods, 325–326 OnRemove/OnRemoveComplete methods, 326–327 OnSet/OnSetComplete methods, 327–328 OnValidate method, 324–325 overview, 324 Dictionary property, 324 Dictionary(T) class, 512 Dictionary(TKey,TValue) class adding items to dictionaries, 297–298 checking dictionaries, 301–304 creating dictionaries, 294–296 Dictionary.KeyCollection Keys, 304–305 Dictionary.ValueCollection Values, 305–306 overriding GetHashCode method in, 114 overview, 292 removing items from dictionaries, 298–299 retrieving values from dictionaries with keys, 299–301 using, 293–294 DisplayMember property (ComboBox control), 539 Dispose method AssociativeArrayAL(TKey,TValue) class, 388 AssociativeArrayHT(TKey,TValue) class, 394 CircularBuffer(T) class, 357 defined in IDisposable interface, 352 DoubleLinkedList(T) class, 364 QueuedArray(T) class, 370 StackedArray(T) class, 377 StackedLinkedList(T) class, 382 Distinct method, 468 Division method, 112 DoubleLinkedList(T) class collection support, adding to, 403–408 creating constructors in, 59–60 enumeration support for, 360–367 doubly linked lists allowing users to add items, 60–68 allowing users to remove items, 68–75 constructors, creating, 59–60 DoubleLinkedListNode(T), 54 DoubleLinkedList(T) class, declaring, 57–59 helper methods and properties, 76–81 Node class, creating, 54–57 overview, 54 Driver console application, creating in Visual Studio, 23 dynamic arrays, 4, 222 E elements in arrays, element.ToString() method, 456 empty associative arrays, 91, 122 empty buffers, 199 empty class, 122 empty lists, 118 empty List(T) instance, creating, 222–223 empty objects, 178 EndNew implementation, 543 Enqueue method, 157, 165, 285 Enter method, 479, 488–489 EnterReadLock method, 494–495 EnterWriteLock method, 497 Entry struct, 118 enumerating over collections, 511 enumeration support, adding to classes ArrayEx(T) class, 349–354 AssociativeArrayAL(TKey,TValue) class, 385–391 AssociativeArrayHT(TKey,TValue) class, 391–396 www.it-ebooks.info helper methods CircularBuffer(T) class, 355–360 DoubleLinkedList(T) class, 360–367 overview, 349–350 QueuedArray(T) class, 367–372 QueuedLinkedList(T) class, 373–374 SingleLinkedList(T) class, 360–367 StackedArray(T) class, 374–378 StackedLinkedList(T) class, 379–384 enumerators, overview of, 345–348 equality comparer bitwise equality basics, 216–218 in Contains method, 19 overview, 215 reference equality basics, 215–216 Equals(T) method, 215 ExceptWith method, 337–338 exclusive locks (thread synchronization), 478–479 Exist method, 266–267 Exit method, 479 ExitReadLock method, 494–495 ExitWriteLock method, 497 F FIFO (First In, First Out) collections, 153 filtering results (LINQ), 458–459 filtering support (IBindingListView interface), 563–568 FindAll method, 247 FindIndexData method, 560–562 FindIndex/FindLastIndex methods, 251–257 FindIndex method, 247 FindKey method, 102, 126, 146, 420 FindLast method, 279 Find method doubly linked lists and, 76 linked lists and, 279 List(T) and, 247 to search for items with properties matching keys, 557–558 to view contents of lists, 49–50 FindValue method, 102 First method (LINQ queries), 448 First property (linked lists), 279 flags, using bitwise operations on, 310–313 forcing immediate query executions (LINQ), 446–449 foreach statements vs from clauses, 454 interaction with two interfaces, 347–349 using with List(T) class, 224–225 from clauses (LINQ), 454–459 FullOperation property, 199 G GetEnumerator method ArrayEx(T) class, 346–347, 350 AssociativeArrayHT(TKey,TValue) class, 392 DoubleLinkedList(T) class, 361 QueuedLinkedList(T) class, 374 StackedArray(T) class, 375 StackedLinkedList(T) class, 380 GetHashCode method, 112 Get method, accessing bits in arrays with, 309–310 GetObjectData method, 523 group clauses (LINQ), 461–463 “grow by” values, GROW_BY constant, GROW_BY size (arrays), H hashing function, 105 HashSet(T) class adding items to, 330–331 Add method, 330 Clear method, 331 creating, 329–330 HashSet(T) (IEnumerable(T)), 329 HashSet(T) ( IEnumerable(T), IEqualityComparer(T)), 330 HashSet(T) ( IEqualityComparer(T)), 330–331 overview, 329 performing set operations on, 333–338 Remove method, 331–332 RemoveWhere method, 332–333 removing items from, 331–333 hash tables for associative arrays advantages/disadvantages of, 105 allowing users to associate values with keys, 123–130 allowing users to remove keys, 130–134 AssociativeArrayHT(T) class, creating, 119–122 chaining, 110–111 constructors for AssociativeArrayHT(T) class, 122–123 defined, 105 hashing function, picking, 112 hash table buckets, 106–107 hash table collisions, 107–109 internal storage, implementing, 116–118 number of buckets, picking, 113–116 Object.GetHashCode, 112 Head method doubly linked lists and, 78 singly linked lists and, 52 Head pointer, 48 Head property doubly linked lists and, 60 nodes and, 34, 42 to view status of lists, 49–50 helper function to copy contents of arrays, 22 helper methods adding to arrays, 17–22 adding to association lists, 98–104 adding to associative arrays, 136–145 adding to CircularBuffer(T) class, 205–207 adding to doubly linked lists, 76–81 adding to QueuedArray(T) class, 159–163 www.it-ebooks.info 615 616 helper methods helper methods (continued) adding to QueuedLinkedList(T) class, 167–169 adding to singly linked lists, 49–54 adding to StackedArray(T) class, 180–182, 185–187 to convert elements of arrays to strings, 24–25 HierarchicalDataTemplate, 603 I IBindingList interface binding with DataGridView control, 578–580 list manipulation support, adding, 541–543 notification support, adding, 543–552 overview, 541 searching support, adding, 557–562 sorting support, adding, 553–557 IBindingListView interface (Windows Forms) advanced sorting, adding, 568–574 binding objects with DataGridView control, 580 filtering support, adding, 563–568 ICancelAddNew interface, 542 ICollection/ICollection(T) interfaces, 397–398 ICollection.SyncRoot property, 489–490 ICollectionView interface BindingListCollectionView, when to use, 597–598 binding with CollectionView class, 605–608 binding with ComboBox control, 598–599 binding with ListBox control, 600–601 binding with ListView control, 601–602 binding with TreeView control, 603–605 overview, 596, 597 IComparer(T) interface, 219 IDictionary/IDictionary(TKey,TValue) interfaces, 434–435 IDisposable interface, 352 IEnumerable/IEnumerator interfaces, 345–348, 454 IEnumerable(T) interface, 223, 350 IEquatable(T) interface, 215, 218 IFormatter interface, 516 IList/IList(T) interfaces, 428–429 IList(T)/IList support, adding to classes ArrayEx(T) class, 429–433 illustrations allowing users to add items to collection, 34 allowing users to add items to doubly linked lists, 60–61 allowing users to remove items from collections, 42 arrays, indexing, circular buffers, changing capacity of, 207 doubly linked lists, 54 hash table buckets, 106, 108 internal storage (circular buffers), 195–196 nodes in doubly linked lists, 69 sequence of nodes in doubly linked lists, 54 singly linked lists, 28 incrementing m_count (arrays), 11 indexing arrays, indexing collections, 557 IndexOf method, 17–22, 222, 263–265 Index property, 309 initializing collections, 453 Initialize method, 8–10, 198 objects during creation, 452–453 InnerHashtable property, 324 inner joins, 463–465 INotifyCollectionChanged interface implementing, 583–589 notifying users of cleared items, 590–592 OnClear/OnClearComplete methods, 590–592 overview, 583 INotifyPropertyChanged/INotifyPropertyChanging interfaces, 541, 550 INotifyPropertyChanged method, 576–577, 581 inserting items into List(T) class, 230–231 Insertion method (arrays), 11 Insert method, 230–231, 575 InsertRange method, 230–231 installing code samples, xvii int Count, 287, 292–293, 303 int Count { get; }, 280–281 integers creating random array of, 25, 81–85 IntegerType enumeration, 464–465 Interlocked.CompareExchange method, 482 interlocked operations (thread synchronization), 475 InternalObject collection class (example), 487 internal storage circular buffers and, 195–198 implementing (hash tables), 116–118 IntersectWith method, 333 int FindIndex(Predicate(T) match) method, 252 int FindLastIndex(Predicate(T) match) method, 252 int IndexOf(T item, int index, int count)/int LastIndexOf(T item, int index, int count) methods, 265–266 int IndexOf(T item, int index)/int LastIndexOf(T item, int index) methods, 264 int IndexOf(T item)/int LastIndexOf(T item) methods, 263–264 int RemoveAll(Predicate(T) match) method, 229 InvalidOperationException, 126, 275, 277 IQueryable(T) interface, 454 IsEmpty property association lists and, 99 checking for empty collections with, 137 looking at list status with, 49–50 QueuedLinkedList(T) class, 167 in queues, 159 searching lists and, 250 ISerializable interface, 518–519 IsEven method, 258, 267 IsFiltered method, 566 IsFixedSize property, 429 IsProperSubsetOf method (HashSet(T) class), 333–334 IsProperSupersetOf method, 334–335 www.it-ebooks.info linked lists IsReadOnly property, 405, 418 IsSorted property, 553 IsSubsetOf method, 335 IsSupersetOf method, 336 IsSynchronization method, 485 IsSynchronized method, 399 IsSynchronized property, 481–483 Item get property, 300–301 Item property associating keys to values with, 123, 297 for retrieving values with keys, 103 to set contents at specific index, 20 using FindKey method with, 146 items adding to arrays, 10–12 adding to dictionaries, 297–298 adding to HashSet(T) class, 330–331 adding to stacks, 289 allowing to remove items from StackedArray(T) class, 185 allowing users to add to CircularBuffer(T) class, 201–203 allowing users to add to collections, 34–42 allowing users to add to doubly linked lists, 60–68 allowing users to add to QueuedLinkedList(T) class, 165 allowing users to add to queues, 157–158 allowing users to add to StackedArray(T) class, 179, 184 allowing users to remove from arrays, 13–17 allowing users to remove from CircularBuffer(T) class, 203–204 allowing users to remove from collections, 42–49 allowing users to remove from doubly linked lists, 68–75 allowing users to remove from QueuedLinkedList(T) class, 166–167 allowing users to remove from queues, 158–159 allowing users to remove from StackedArray(T) class, 180 inserting into List(T) class, 230–231 removing from dictionaries, 298–299 removing from HashSet(T) class, 331–333 removing from List(T) class, 228–230 removing from queues (Queue(T) class), 285–286 removing from stacks, 290–291 ITypedList interface, 598 J join clauses (LINQ), 463–466 K keys allowing users to associate values with, 92–94, 123–130 allowing users to remove, 95–98, 130–134 KeyCollection class, 437 property, 99, 137, 304–305 retrieving values from dictionaries with, 299–301 Key/Value pair support, adding to classes AssociativeArrayAL(TKey,TValue) class., 436–440 AssociativeArrayHT(TKey,TValue) class, 437–440 overview, 435 KeyValuePair(TKey,TValue) struct, 419 KVPair struct, 91 L lambda expressions to See Whether All Match, 268–269 using for Action(T) method, 227–228 using for Comparison(T) method, 238 using for FindAll method, 258 using for find operations, 249–250 using for matching (searching lists), 255, 257 using for sorting, 555 using to Check for Existence, 267–268 using to convert phone number, 271 using with RemoveAll method, 229 using with RemoveWhere, 332–333 in Visual Basic, 221 writing inline methods with, 220 LastIndexOf method default equality comparer and, 222 searching lists with, 263–265 Last property (linked lists), 279 let clauses (LINQ), 466–468 LIFO (Last In, First Out) collections, 175 stacks implemented as, 413 linked lists advantages of, 27 classes, serializing, 524–528 class, using, 81–85 defined, 27 disadvantages of, 27 doubly linked lists See doubly linked lists LinkedListNode(T) AddAfter(LinkedListNode(T) node, T value), 274 LinkedListNode(T) AddBefore(LinkedListNode(T) node, T value), 275 LinkedListNode(T) AddFirst(T item), 275 LinkedListNode(T) AddLast (T item), 276 LinkedListNode(T) Find(T value)/LinkedListNode(T) FindLast(T value), 279–280 LinkedListNode(T) First { get; }/LinkedListNode(T) Last { get; }, 280 singly linked lists See singly linked lists uses of, 27–28 using arrays to create, 81 using to implement queues See queues using to implement stacks See stacks www.it-ebooks.info 617 618 LinkedList(T) class LinkedList(T) class adding nodes to linked lists, 273–276 creating new linked lists, 273 obtaining information about linked lists, 279–281 overview, 272 removing nodes from, 277–280 using, 273 LINQ (Language Integrated Query) additions to NET language for, 451–453 basic query actions, 442 data sources used with, 442–443 filtering results (where clause), 458–459 group clause, 461–463 join clause, 463–466 let clause, 466–468 nesting statements with, 442 ordering results (orderby clause), 460–461 picking data source and selecting results, 453–458 query execution with, 443–449 querying data with and without (examples), 441–442 structure for (examples), 449–450 ListBox control binding with, 577–578, 600–601 setting DisplayMember property of, 539–540 ListChanged event, 543, 552, 584 ListChangeType.ItemChange notification, 552 ListCollectionView, 598, 605 lists association lists See association lists doubly linked See doubly linked lists list manipulation support (IBindingList interface), 541–543 singly linked See singly linked lists List(T) classes appending items to, 223–224 checking list contents, 263–269 creating, 222–223 inserting items into, 230–231 List(T)(IEnumerable(T) collection), 223 List(T)(int size), 223 ListToString method, 232 modifying lists, 269–272 overview, 222 removing items from, 228–230 searching See searching List(T) classes sorting See sorting List(T) classes traversing, 224–228 List(T) FindAll(Predicate(T) match) method, 257–258 List(TOutput) ConvertAll(Converter(T, TOutput) converter), 269–271 ListView control, binding with, 601–602 locking mechanisms (threads), 474–475, 478–480, 487 LockRecursionPolicy.NoRecursion, 500 LockRecursionPolicy.SupportRecursion, 500 locks, upgradeable, 500–503 M Main method (arrays), 26 mapping values to keys See hash tables for associative arrays m_array field, 352, 376 Max method (LINQ queries), 448 m_buffer field CircularBuffer(T) class, 357 QueuedArray(T) class, 369 m_capacity field, 118 m_comparer field (association lists), 90 m_count field, 8, 32, 59, 118 m_current field, 363 m_currentNode field, 387 m_data field DoubleLinkedList(T) class, 183 internal data storage with (queues), 155 Node class, 57 QueuedLinkedList(T) class, 164 sorting, 554 StackedArray(T) class, 178 m_end field, 363 methods adding helper methods to doubly linked lists, 76–81 anonymous, 219 helper methods, adding to arrays, 17–22 helper methods, adding to singly linked lists, 49–54 to reverse order of array contents, 80 m_head field, 32, 59 Microsoft NET Framework 32-bit/64-bit applications, Microsoft Visual Basic project, Microsoft Visual C# class library project, m_index field, 352, 357 m_list field, 363, 381 m_newIndex field, 542, 543 m_next field, 31, 57 modifying lists, 269–272 modulus (mod) operation, 196, 267 modulus operator, 112, 403 Monitor class, 478, 487–490 MoveNext method ArrayEx(T) class, 348, 353–354 AssociativeArrayAL(TKey,TValue) class, 389, 390 AssociativeArrayHT(TKey,TValue) class, 395 CircularBuffer(T) class, 359 DoubleLinkedList(T) class, 365–366 QueuedArray(T) class, 371 StackedArray(T) class, 378 StackedLinkedList(T) class, 383 traversing collections with, 139 m_owner field, 31, 57 m_prev field, 57 m_syncRoot field, marking as nonserializable, 528, 529 m_tail field doubly linked lists, 64 DoublyLinkedList(T) class, 59 to eliminate traversing complete lists, 37 maintaining node references with, 32 www.it-ebooks.info Prev property (doubly linked lists) multiline lambda statements, 221 m_updateCode field association lists and, 90 AssociativeArrayHT(TKey,TValue) class, 393 CircularBuffer(T) class, 357 to determine changes in collections, 352 DoubleLinkedList(T) class and, 59, 363 QueuedArray(T) class, 369 QueuedLinkedList(T) class, 164 queues, implementing with arrays, 155 StackedArray(T) class, 178, 183 StackedLinkedList(T) class, 381 storing value of before enumeration, 511 user list modification and, Mutex class, 478 MyStringComparer.GetHashCode method, 116 N NameToIndex method, 107, 109 N elements in arrays, nested locks, 485 NET collections, using as LINQ data source, 443 NET Framework ArrayList class in, hash codes and different versions of, 112 tools for thread synchronization, 475–479 NET language, LINQ additions to, 451–453 Next field, 118 Next method, 181 NextOperation field, 188, 190 next pointers (linked lists), 27 Next property doubly linked lists, 60–61 nodes and, 34, 42 Node class, creating in doubly linked lists, 54–57 in singly linked lists, 28–30 nodes in doubly linked lists, 54, 68–69 removing, 48 removing from LinkedList(T) class, 277–280 non-exclusive locks (thread synchronization), 480–481 NonSerializable attribute, 513, 516, 521 NotificationList(T) class, 584 notification support (IBindingList interface), 543–552 Not method (BitArray class), 313 NULL_REFERENCE constant, 118 null value, 50, 77 O Object.Equals(Object) method, 215, 218 Object.GetHashCode method, 112 objects filtering list of, 459 initializing during creation, 452–453 ObservableCollection(T) class overview, 593 recursive collection change events, 595–596 using, 593–594 oddInts variable (LINQ), 448 OnClear/OnClearComplete methods CollectionBase class, 318–319 DictionaryBase class, 325 OnGet method (DictionaryBase class), 325 OnInsert/OnInsertComplete methods CollectionBase class, 319–323 DictionaryBase class, 325–326 notification support and, 543 OnListChanged method, 552 O(n) operations, 222 OnRemove/OnRemoveComplete methods CollectionBase class, 321–322 DictionaryBase class, 326–327 notification support and, 543 OnSet/OnSetComplete methods CollectionBase class, 323–324 DictionaryBase class, 327–328 OnValidate method CollectionBase class, 317–318 DictionaryBase class, 324–325 OnXXX/OnXXXComplete methods, 543, 584 operators, modulus, 112 orderby clauses (LINQ), 460–461 ordering comparer, 218–219 Or method (BitArray class), 314–315 outer joins, 465 Overlaps method (HashSet(T)) class, 336–337 P Peek method QueuedLinkedList(T) class, 167 Queue(T) class, 286 StackedArray(T) class, 181, 185–186 to view contents of queues, 159 to view items at top of stacks, 291 performance penalties, PersonAgeComparer class (list sorting), 241 PersonComparer class (searching lists), 259–260 PersonNameComparer class (sorting lists), 244 Person struct, 236 Person structure defined in Sort(Comparison(T)) method, 240 Plate class, defining (stacks example), 187–188 Pop method QueuedLinkedList(T) class and, 166 removing items from stacks with, 290–291 removing items from queues with, 158 StackedArray(T) class and, 185 post-fix Attribute, 513 Predicate(T) method, 247, 251, 257 previous pointers (linked lists), 27 Prev property (doubly linked lists), 61–62 www.it-ebooks.info 619 620 prime numbers prime numbers, 113–115, 130 PrivateField field, 515 ProcessTask as Action(T) (example), 225–228 properties adding to arrays, 17–22 adding to association lists, 98–104 adding to associative arrays, 136–145 adding to CircularBuffer(T) class, 205–207 adding to doubly linked lists, 76–81 adding to QueuedArray(T) class, 159–163 adding to QueuedLinkedList(T) class, 167–169 adding to singly linked lists, 49–54 property change notifications, 552 ProtectedField field, 515 PublicField field, 515 PublicObject collection class (example), 487 pushing items onto queues, 285 Push method CircularBuffer(T) class, 202 QueuedArray(T) class, 157 QueuedLinkedList(T) class, 165 StackedArray(T) class, 179, 184 Stack(T) class, 289 Q query executions (LINQ), 443–449 Queue classes, serializing, 532–533 QueuedArray(T) class adding collection support to, 408–410 enumeration support for, 367–372 QueuedLinkedList(T) class adding collection support to, 411–413 enumeration support for, 373–374 queues allowing users to add items to QueuedArray(T) class, 157–158 allowing users to add items to QueuedLinkedList(T) class, 165 allowing users to remove items from QueuedArray(T) class, 158–159 allowing users to remove items from QueuedLinkedList(T) class, 166–167 constructors, creating in QueuedArray(T) class, 155–157 constructors, creating in QueuedLinkedList(T) class, 164–165 defined, 153 helper methods and properties, adding to QueuedArray(T) class, 159–163 helper methods and properties, adding to QueuedLinkedList(T) class, 167–169 implementing with arrays, 154–155 implementing with linked lists, 162–163 QueuedArray(T) class, 154 QueuedLinkedList(T) class, 163 uses of, 153 using QueueArray(T)/ArrayEx(T) classes See song request line simulator using QueueArray(T) (example ) Queue(T) class adding to queues, 285–286 checking queues, 286–287 cleaning queues, 287 creating queues, 284 in Microsoft NET Framework, 154–155 overview, 283 removing items from queues, 285–286 Quicksort algorithm (Array.Sort), 232–235 R Random class (random numbers), 25 Range class (enumeration example), 346–348 range variable elements, 455 ReaderWriterLock class, 480–481 ReaderWriterLockSlim class for allowing access to multiple threads, 480–481 AverageArray method, 494–495 recursive locking and, 500 ReverseArray method, 490–493 State class, 493–495 SumArray method, 490–493 upgradeable locks, using, 500–503 ReapplyFilter method, 566 recursive collection change events, 595–596 recursive locking, 474–475, 500 reference equality, 215–218 references, arrays of, RemoveAll method, 98, 134, 228 RemoveAt method, 14, 228, 575 Remove(DoubleLinkedListNode(KVPair)) method, 98 Remove(EntryData) method, 134, 136 RemoveFilterInternal function, 566 RemoveFilter method, 563, 568 RemoveFirst method, 277, 278 RemoveIndex method, 562 RemoveLast method, 277, 278–279 Remove method arrays and, 10, 13–17 in associative arrays, 130 associative lists, 95 calling in BindingSource, 575 default equality comparer and, 222 in doubly linked lists, 74 HashSet(T) class, 331–332 linked lists, 277–278 nodes and, 42–49 to remove items from lists, 228 to remove values associated with specific keys, 298 RemoveRange method, 228 RemoveSort method, 556–557, 568–569 www.it-ebooks.info StackedArray(T) class RemoveValue method in associative arrays, 130 associative lists and, 95, 96 RemoveWhere method, 332–333 removing items from dictionaries, 298–299 items from HashSet(T) class, 331–333 items from List(T) class, 228–230 items from queues (Queue(T) class), 285–286 items from stacks, 290–291 nodes from LinkedList(T) class, 277–280 Reset method AssociativeArrayAL(TKey,TValue) class, 391 AssociativeArrayHT(TKey,TValue) class, 396 CircularBuffer(T) class, 360 DoubleLinkedList(T) class, 367 for COM interoperability, 346 QueuedArray(T) class, 372 StackedArray(T) class, 379 StackedLinkedList(T) class, 384 ReverseArray method, 470–473, 490–493 reversedNumbers variable, 334 Reverse method, 269, 272–273 S SaveUnsortedList method, 574 searching List(T) classes BinarySearch methods, 259–263 FindIndex/FindLastIndex methods, 251–257 List(T) FindAll(Predicate(T) match) method, 257–258 overview, 247 T Find(Predicate(T) match)/T FindLast(Predicate(T) match) methods, 247–252 searching support (IBindingList interface), 557–562 select clauses, 454–458 selection sorts, performing on arrays, 25 Semaphore class, 480 serializing collections adding serialization support to collection classes, 521–522 ArrayEx(T) Class, 522–524 ArrayEx(T) class definition, changing, 521–522 associative array classes, 528–531 controlling serialization behavior, 517–521 Deserialize method, 516 Formatter classes, 513–521 linked list classes, 524–528 Queue classes, serializing, 532–533 Serializable attribute, 513–517, 521 Serialize method, 516 Stack classes, serializing, 533–534 SetAll method, 309 Set method, 308 set operations, performing on HashSet(T) class, 333–338 set property (doubly linked lists), 57 signaling (thread synchronization), 476–479 Silverlight ComboBox class and, 598 ListBox class and, 600 ListView class and, 601 TreeView class and, 603 using collections in, 583 simple data binding (Window Forms), 539–540 SingleLinkedList(T) class collection support, adding to, 403–408 enumeration support for, 360–367 singly linked lists allowing users to add items, 34–42 allowing users to remove items, 42–49 constructors, creating, 33–34 helper methods and properties, adding, 49–54 Node class, creating, 28–30 overview, 28–29 SingleLinkedList(KVPair), 110–111 SingleLinkedListNode(T), defining, 28–30 SingleLinkedList(T) class, declaring, 31–33 song request line simulator using CircularBuffer(T) (example), 210–211 song request line simulator using QueueArray(T) (example ) drawing separator on screen, 171 loop pending keyboard press, 171–175 overview, 170–171 random collection of songs, creating, 171–172 variable declarations, 170 SortDescriptions property, 568 SortDirection property, 553, 570 sorted collections overview, 339–340 SortedDictionary(TKey, TValue) class, 222, 339–341 SortedList(TKey, TValue) class, 339 sorted lists SortedList(TKey,TValue) class, 222 writing to console (arrays), 26 sorting advanced (IBindingListView interface), 568–574 BindingListCollectionView, 607 ListCollectionView, 607 sorting support (IBindingList interface), 553–557 Sort method, 222, 555 SortProperty property, 553, 570 sorting List(T) classes built-in sorting, 232–235 overview, 231 void Sort(), 236 void Sort(Comparison(T) comparison), 236–239 void Sort(IComparer(T) comparer), 240–241 void Sort(int index, int count, IComparer(T) comparer), 242–246 StackedArray(T) class adding collection support to, 412–414 creating, 177–178 enumeration support for, 374–378 www.it-ebooks.info 621 622 StackedLinkedList(T) class StackedLinkedList(T) class adding collection support to, 415–418 enumeration support for, 379–384 stacks adding common functionality, 175–176 allowing users to add items to StackedArray(T) class, 179, 184 allowing users to remove items from StackedArray(T) class, 180, 185 cafeteria plate simulation (example) See cafeteria plate simulation (example) constructors, creating in StackedArray(T) class, 178–179, 183–184 helper methods, adding to StackedArray(T) class, 180–182, 185–187 serializing Stack classes, 533–534 StackedLinkedList(T) class, 182–183 uses of, 175 Stack(T) class adding items to stacks, 289 checking stacks, 291–292 cleaning stacks, 292 creating stacks, 288–289 in NET Framework, 175 overview, 288 removing items from stacks, 290–291 start/end pointers (circular buffers), 195, 207 State class, 493–495 storage, internal (circular buffers), 195–198 streams, serialization and, 516 strings convert elements of arrays to, 24–25 converting array elements to, 82–83 structures as value types, 217 subexpressions, storing with let clauses, 466 SumArray method, 470–473, 490–493, 497 SupportsAdvancedSorting property, 568 SupportsChangeNotification flag, 552 SupportsChangeNotification property, 543 SupportsFiltering property, 563 SupportsSearching property, 557 SupportsSorting property, 553 synchronization, thread See thread synchronization synchronized collection classes, 511–512 SynchronizedCollection(T) class, 511 SynchronizedKeyedCollection(T) class, 512 SynchronizedReadOnlyCollection(T) class, 512 Synchronized Wrapper class, 504–510 SyncLock statement, 478 SyncRoot method, 399 SyncRoot property, 481–483, 483–486 System.Collections.Generic namespace, 215, 218 System.Collections.IEqualityComparer interface, 112 system requirements for exercises, xvi T Tail method, 52, 78 Tail property, 42, 49–50, 61 T Dequeue() method, 286–287 T Find(Predicate(T) match)/T FindLast(Predicate(T) match) methods, 247–252 This keyword in C#, 20 threads basics, 469 Monitor class, using, 487–490 ReaderWriterLockSlim class See ReaderWriterLockSlim class thread synchronization defined, 470 NET Framework tools for, 475–479 supporting collection classes with, 480–482 Synchronized Wrapper class, implementing, 504–510 Synchronized Wrapper class vs SyncRoot, 483–486 value of (example), 470–473 writing code as needed, 474–475 ToArray method (LINQ queries), 446 ToList method (LINQ queries), 446 ToString method, T Peek() method, 286, 291–292 T Pop() method, 290 traversing List(T) class, 224–228 TreeView control, binding with, 603–605 TrimExcess method to change capacity of stacks, 290, 292 HashSet(T) class, 338 to modify capacity of lists, 228 to reclaim memory (Queue(T) class), 287 Trim method, 269 TrueForAll method, 267–269 TryEnter method, 479, 488–489 TryEnterReadLock method, 496 TryGetValue method, 104, 146, 299–300 TValue Item[TKey key] { get; }, 300–301 TValue Item[TKey key] { set; }, 297 two-way data binding IBindingList interface, implementing See IBindingList interface overview, 540 U UnionWith method (HashSet(T) class), 337 UnpackPhoneNumber method, 271 Update button (TreeView control), 604 Update Item button binding with ListView control, 602 ComboBox control, 576 upgradeable locks, using, 500–503 www.it-ebooks.info Windows Forms users allowing users to add items (StackedArray(T) class), 179 allowing users to add items to arrays, 10–12 allowing users to add items to CircularBuffer(T) class, 201–203 allowing users to add items to collections, 34–42 allowing users to add items to doubly linked lists, 60–68 allowing users to add items to QueuedLinkedList(T) class, 165 allowing users to add items to queues, 157–158 allowing users to add items to StackedArray(T) class, 184 allowing users to associate values with keys, 92–94, 123–130 allowing users to remove items from arrays, 13–17 allowing users to remove items from CircularBuffer(T) class, 203–204 allowing users to remove items from collections, 42–49 allowing users to remove items from doubly linked lists, 68–75 allowing users to remove items from QueuedLinkedList(T) class, 166–167 allowing users to remove items from queues, 158–159 allowing users to remove items from StackedArray(T) class, 180, 185 allowing users to remove keys, 95–98, 130–134 V values arrays of, ValueCollection class, 437 ValueMember property (ComboBox control), 540–541 Values property, 99, 137, 305–306 variable Operation using named method (example), 219–220 var keyword, 451 Visual Basic (Microsoft) implementing Item property with, 20 lambda expressions in, 221 var keyword in, 451 Visual C# (Microsoft), var keyword in, 451 void AddAfter(LinkedListNode(T) node, LinkedListNode(T) newNode), 273 void AddBefore(LinkedListNode(T) node, LinkedListNode(T) newNode), 274 void AddFirst(LinkedListNode(T) node), 275–276 void AddLast (LinkedListNode(T) node), 276 void AddRange(IEnumerable(T) collection), 224 void Add(T item) (List(T) class), 223–224 void Add(TKey key, TValue value), 297 void Clear(), 285, 290, 298, 331 void Enqueue(T item), 285 void ExceptWith(IEnumerable(T) other), 337–338 void ForEach(Action(T) action), 225–228 void Insert(int index, T item), 231 void InsertRange(int index, IEnumerable collection), 231 void IntersectWith(IEnumerable(T) other), 333 void OnClear() and void OnClearComplete(), 318 void OnGet(), 325 void OnInsertComplete(Object key, Object value), 325 void OnInsert(int index, Object value), 319 void OnInsert(Object key, Object value), 325 void OnRemoveComplete(Object key, Object value), 326 void OnRemove(Object key, Object value), 326 void OnSetComplete(Object key, object oldValue, object newValue), 327 void OnSet(Object key, object oldValue, object newValue), 327 void OnValidate(object key, object value), 324–325 void OnValidate(object value), 317 void Push(T item), 289 void RemoveAt(int index), 230 void RemoveFirst(), 278 void RemoveLast(), 278–279 void RemoveRange(int index, int count), 230 void Reverse(), 272 void Reverse(int index, int count), 272 void SetAll(bool value), 309 void Set(int index, bool value), 308 void Sort(), 236 void Sort(Comparison(T) comparison), 236–239 void Sort(IComparer(T) comparer), 240–241 void Sort(int index, int count, IComparer(T) comparer), 242–246 void TrimExcess(), 272, 288, 338 void UnionWith(IEnumerable(T) other), 337 W WaitAll method, 477 WaitAny method, 477 WaitHandle class, 476, 477 Wait method, 479 websites, for further information Dispose method, 352 downloading code samples, xvii HierarchicalDataTemplate, 603 LINQ data sources, 442 where clause (LINQ), 458–459 Windows Forms binding with BindingSource object, 581–582 BindingList(T) class, using, 574 BindingSource class, 575–576 binding with ComboBox control, 576–577 binding with DataGridView control/IBindingListView, 580 binding with DataGridView/IBindingList control, 578–580 binding with IBindingList, 578–580 binding with ListBox control, 577–578 www.it-ebooks.info 623 624 Windows Forms Windows Forms (continued) IBindingList Interface, implementing See IBindingList Interface IBindingListView interface, implementing See IBindingListView interface (Windows Forms) simple binding, 539–540 two-way data binding See two-way data binding WinFormsBindingList(T) class, 547, 550, 559–560 WinFormsBindingListView(T) class, 562 WPF (Windows Presentation Foundation) ComboBox class and, 598 ListBox class and, 600 ListView class and, 601 TreevIew class and, 603 using collections in, 583 X XmlSerializer, 513 Xor method (BitArray class), 314–315 www.it-ebooks.info About the Author Calvin Janes is currently a Principal Software Consultant with over 20 years of professional experience He has been hooked on programming ever since he wrote a 1,000-line BASIC program in third grade Since then, he has worked on everything from 3D graphics to developing software for helicopters and control systems When not working, he enjoys tinkering with microcontrollers and robotics, and exploring how they can be applied to the medical field He plays several instruments and received an Emergency Medical Technician (EMT-B) certification while working as a volunteer firefighter www.it-ebooks.info www.it-ebooks.info ... (WPF) Finding Your Best Starting Point in This Book Developer’s Guide to Collections in Microsoft NET is designed to be a complete guide to collections Depending on your needs and your existing... Chapter in Part III Interested in using threads with collections Read through Chapter in Part III Interested in serializing your custom collections Read through Chapter in Part III Interested in using... existing Microsoft Visual Basic and Microsoft Visual C# developers understand collections in NET It is useful both for developers designing new applications and developers maintaining existing