Pages

Interfaces

Interface are a type similar to class, where it cannot have the Method Content, rather it has the definition of Method. it will not have properies and members variables. the class which inherits the interface should implement all the methods of the interface. the interface forces the derived class to implement, otherwise it will not get compiled. The below lists ome of common interfaces of .Net
1. IComparable - Implemented by ttypes whose value can be ordered, it is ued for sorting.
2. Idisposable - Defines this method to dispose of a object manually, this is important most commonly used Interface when dealing with more big objects, and also to release the object which holds the resource like database.
3. IConvertible - Enables the class to to base type such as string, int or bool.
4. IClonable - Supports object copying
5. IEquatable - Allows to compare to object instances.
6. IFormatable - Provides way to convert the value of object into an formatted string. This is similar to ToString() method, but provides greater flexibility than it.

No comments:

Post a Comment