 Introduction
 Types
 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
 IEnumerable
 IEnumerable<T>
 IEnumerator
 Ienumerator<T>
 ICollection
 Icollection<T>
 Idictonary
 Ilist
 Ilist<T>
 Icompare
 IEqualityComparer<T>
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( )
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( )
ICollection
 Properties -
Count
IsSynchronized
IsReadonly
 Methods -
CopyTo ( )
GetEnumerator ( 0
ICollection<T>
 Defines methods to manipulate generic collections.
 T- type of elements in the collection
 Properties -
Count
IsReadonly
 Methods -
Add ( ) Clear ( )
Contains ( ) Remove ( )
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.
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
IEqualityComparer
 Defines methods to support the comparison of objects for equality.
 Methods -
Equals ( )
GetHashCode ( )
IComparer
 Exposes a method that compares two objects.
 Methods -
Compare ( )
Thank you

C# Colletion interfaces

  • 2.
  • 3.
     It makesprograms 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 simpleiteration 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 iterationover 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( )
  • 7.
    ICollection  Properties - Count IsSynchronized IsReadonly Methods - CopyTo ( ) GetEnumerator ( 0 ICollection<T>  Defines methods to manipulate generic collections.  T- type of elements in the collection  Properties - Count IsReadonly  Methods - Add ( ) Clear ( ) Contains ( ) Remove ( )
  • 8.
    IList  Represents anon-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 anon-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 methodsto support the comparison of objects for equality.  Methods - Equals ( ) GetHashCode ( ) IComparer  Exposes a method that compares two objects.  Methods - Compare ( )
  • 11.