Saturday 3 July 2010

Visual Studio: Implementing interfaces

An interface is implemented at class definition level by using the : (colon) operator after the class name but before the interface name. Then, you must provide concrete implementations of the methods of that interface. In Visual Studio, this task is automated for you; so, you do not have to type out all the methods.

Steps:

  1. Type the classname.
  2. Type the colon (:).
  3. Type either Ctrl+Space or begin typing the interface name to bring up the IntelliSense menu. Select the interface name from the menu list.
  4. Right click the interface name and select Implement Interface from the popup menu.


Implementing an interface in Visual Studio
Figure: Implementing an interface in Visual Studio

No comments:

Post a Comment