Wednesday, June 4, 2014

Explain Interfaces in .Net

Interfaces define the properties, methods, and events that classes can implement. Interfaces allow you to define features as small groups of closely related properties, methods, and events; this reduces compatibility problems because you can develop enhanced implementations for your interfaces without jeopardizing existing code. You can add new features at any time by developing additional interfaces and implementations. Interfaces cannot contain any implementation code or statements associated with implementation code

Click here to see when and why we need to create Interfaces

There are several other reasons why you might want to use interfaces instead of class inheritance:

• Interfaces are better suited to situations in which your applications require many possibly unrelated object types to provide certain functionality.

• Interfaces are more flexible than base classes because you can define a single implementation that can implement multiple interfaces.

• Interfaces are better in situations in which you do not have to inherit implementation from a base class.

• Interfaces are useful when you cannot use class inheritance. For example, structures cannot inherit from classes, but they can implement interfaces.

No comments:

Post a Comment

React-select is very slow on larger list - Found solution - using react-window

 I had more than 4000 items in searchable dropdownlist. I have used react-select but it was very slow. finally I found complete solution to ...