Free mag vol1 | Page 18

 CONTENTS The IComparable Interface ............................................................................................313 Specifying Multiple Sort Orders with IComparer .................................................................................. 316 Custom Properties and Custom Sort Types .......................................................................................... 317 Summary .......................................................................................................................318  Part IV: Advanced C# Programming ...................................................................319  Chapter 9: Collections and Generics ...................................................................321 The Motivation for Collection Classes............................................................................321 The System.Collections Namespace .................................................................................................... 323 A Survey of System.Collections.Specialized Namespace..................................................................... 325 The Problems of Nongeneric Collections.......................................................................326 The Issue of Performance..................................................................................................................... 326 The Issue of Type Safety ...................................................................................................................... 330 A First Look at Generic Collections....................................................................................................... 333 The Role of Generic Type Parameters ...........................................................................334 Specifying Type Parameters for Generic Classes/Structures ............................................................... 335 Specifying Type Parameters for Generic Members .............................................................................. 336 Specifying Type Parameters for Generic Interfaces ............................................................................. 337 The System.Collections.Generic Namespace ................................................................338 Understanding Collection Initialization Syntax ..................................................................................... 340 Working with the List Class ........................................................................................................... 341 Working with the Stack Class........................................................................................................ 342 Working with the Queue Class....................................................................................................... 343 Working with the SortedSet Class ................................................................................................. 345 The System.Collections.ObjectModel Namespace.........................................................346 Working with ObservableCollection............................................................................................... 347 Creating Custom Generic Methods ................................................................................349 Inference of Type Parameters .............................................................................................................. 351 xvi