Define most commonly used interfaces in Net Framework.1. IComparable : It is implemented by types for ordering and sorting. The implementation types must implement one single method i.e. CompareTo.
2. 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.
3. 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.
4. ICloneable : Allows creating objects of a class having same values as another instance using the Clone method.
5. IEquatable : Implemented to create type specific methods to know the equality between various objects.
6. IFormattable : Implemented to convert object into string representations. Objects can define their own specific string representation through this interface’s ToString() method.
|