Monday, November 28, 2011

Define most commonly used interfaces in .Net Framework

IComparable: It is implemented by types for ordering and sorting. The implementation types must implement one single method i.e. CompareTo.

IDisposable:This is implemented to manage release of unmanaged resources from memory. The garbage collector acts on its own and hence the Dispose method is used to call the garbage collector to free unmanaged resources through this interface.

IConvertible: It is implemented to convert value of the implementing type into another CLR compatible type. If the conversion fails then an invalidcastexception is thrown.

ICloneable: Allows creating objects of a class having same values as another instance using the Clone method.

IEquatable:Implemented to create type specific methods to know the equality between various objects.

IFormattable:Implemented to convert object into string representations. Objects can define their own specific string representation through this interface’s ToString() method.

No comments:

Post a Comment