More Related Content Similar to C# Colletion interfaces (20) More from Prem Kumar Badri (20) C# Colletion interfaces3. It makes programs more compact and easier.
Contains Methods, Indexes, Events and
Properties.
.NET class library defines 2 different interfaces-
1. Generic Interfaces
2. Non-Generic Interfaces
4. IEnumerable
IEnumerable<T>
IEnumerator
Ienumerator<T>
ICollection
Icollection<T>
Idictonary
Ilist
Ilist<T>
Icompare
IEqualityComparer<T>
5. IEnumerable
Supports simple iteration over non-generic collection
Method –
GetEnumerator( )
IEnumerable<T>
supports iteration over generic collection
T- The type of objects to enumerate.
Method –
GetEnumerator( )
6. IEnumerator
Supports iteration over non-generic collection.
Properties -
Current
Methods -
MoveNext( )
Reset ( )
IEnumerator<T>
Supports iteration over generic collection.
T- type of object to enumerate
Properties -
Current
Methods -
MoveNext( )
Reset ( )
Dispose( )
8. IList
Represents a non-generic collection of objects.
Falls into categories -
1. Read-Only
2. Fixed Size
3.variable Size
Properties -
Count
IsFixedSize
IsReadOnly
Methods -
Add ( ) Clear ( )
Contains ( ) Remove ( )
CopyTO ( ) Insert ( )
IList<T> - Represents a generic collection of objects.
9. IDictonary
Represents a non-generic collection of key/value pair
Falls into categories -
1. Read-Only
2. Fixed Size
3.variable Size
Properties –
Count
IsFixedSize
IsReadOnly
Methods -
Add ( ) Clear ( )
Contains ( ) Remove ( )
CopyTo
10. IEqualityComparer
Defines methods to support the comparison of objects for equality.
Methods -
Equals ( )
GetHashCode ( )
IComparer
Exposes a method that compares two objects.
Methods -
Compare ( )