Hi Saurabh, Interfaces are reference types.Throughout the .NET framework, interfaces are used to define that certain types have well-known behaviors. For example, the ICloneable interface specifies that a .NET type can be cloned and defines a specific programming signature for how cloning is performed. In this way, an interface both advertises a specific functionality or behavior for a .NET type and also defines the method/property signature for the behavior. In .NET, an object can be derived from a single ancestor, yet implement any number of interfaces. There is no problem with multiple interfaces defining a common method; the object being defined would only implement the common method once. This is the difference between interfaces and inheritance. There are several other interfaces woven into the .NET framework that simplify embedding your custom classes into the .NET framework.
*IComparable is used to ensure that your class is sortable. *IClonable is used to ensure that your class can be cloned. Cloning simply creates another instance of the class -- a duplicate of the original. *IFormattable is used to change the behavior when a user of your class invokes the ToString method. *IDisposable is used to provide functionality to release any unmanaged resources, such as COM objects, that your class may be using.
Properly using these interfaces will make classes that you write integrate more tightly with the .NET framework, which will make them behave more predictably when someone tries to use them. Not only can you implement these and other predefined interfaces, you can also define custom interfaces to use in your design. You can also check how IComparable interface is used in .net as shown below: HTH Regards Lakshmi |