 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do you make code reusable in C#?
To make code reusable in C#, use Interfaces. Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members. It often helps in providing a standard structure that the deriving classes would follow.
For example, Shape Interface −
public interface IShape {    void display(); } Above we have declared an Interface Shape. You can notice that it begins with a capital “I”. It is a common convention that interfaces names begin with “I”.
We have not added an access specifier above since interface members are public by default.
In real applications, Polymorphism is key for code reuse. Interfaces are flexible because if you use interfaces, then with its help you can pass anything that implements that Interface.
