Please enable JavaScript.
Coggle requires JavaScript to display documents.
03 Collections and Generics (Generic collection classes (List<T>,…
03 Collections
and Generics
Arrays
Fixed size
No delete / insert
Type safe
Must track next free element
No duplicate checking
Indexers
Using indexers
Authoring indexers
Examples in ADO.NET
Generic
methods
Using generic methods
Authoring generic methods
ArrayList
Any element can hold any object
Not type-safe
Dynamically manages size and free space
Can insert / delete
Came before generics in C#
Need for
generics
Performance
Type safety
Generic algorithms
Increase code re-use
Generic
collection
classes
List<T>
Stack<T>
Queue<T>
SortedSet<T>
Set<T>
Dictionary<K, V>
SortedDictionary<K, V>
SortedList<T>
Labs
Manipulating Person list
using Queue<T>, Stack<T>,
List<T> and indexers
Zoo animals using a Dictionary
Kaprekar numbers (big!)
Generic
classes
Using generic classes
Authoring generic classes
System.Nullable<T>