---
title: "Interface"  
description: "An interface defines the syntactical contract that all the derived class should follow. Especially the interface defines what part of syntactical cont"  
author: "Anonymous User"  
published: 2012-09-11  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/364/interface  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Interface

An [interface](https://www.mindstick.com/articles/12101/interfaces-in-java-extending-interfaces) defines the syntactical [contract](https://www.mindstick.com/blog/212/wcf-contracts) that all the [derived class](https://answers.mindstick.com/qa/30686/what-is-a-base-class-and-derived-class) should follow. Especially the interface defines what part of syntactical contract, and the classes implementing the interface [describe](https://www.mindstick.com/interview/12752/what-is-ddms-describe-some-of-its-capabilities) the how part of the contract.\

[Interfaces](https://www.mindstick.com/articles/12100/interfaces-in-java-real-life-example) also define [properties](https://www.mindstick.com/articles/23331/nootropics-7-different-types-and-their-unique-properties), methods, and evens, which are [known as](https://answers.mindstick.com/qa/35703/ricky-ponting-is-also-known-as-what) members of the interfaces. It is important to note that interfaces contain only the declaration of the members. Classes implement these interface members. Interfaces are used when you want a [standard](https://www.mindstick.com/articles/23223/naming-convention-or-coding-standard) [structure](https://www.mindstick.com/articles/23258/choose-your-business-structure-wisely) of methods to be followed by the classes.

Declaring Interfaces

You can declare interface using the interface keyword.

```
public interface IOrderDetails{                //Declare an interface member                void UpdateCustomerStatus();                void TakeOrder();}
```

##### Example:

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Interface{publicinterface IOrderDetails{//Declare an interface membervoid UpdateCustStatus();void TakeOrder();}publicclass ItemDetails : IOrderDetails// by inheriting the interface, derived class must be implement all the methods declared in the interface,// if we'll no do so, code will generate an error{publicvoid UpdateCustStatus() //implementing the Interface Method{Console.WriteLine("Customer Name is : Jacob ");}publicvoid TakeOrder() //implementing the Interface Method{Console.WriteLine("Order Placed ");}publicvoid BillAmount(){Console.WriteLine("Bill Amount is : 1000");}}classProgram{staticvoid Main(string[] args){ItemDetails objItemDetails = new ItemDetails();objItemDetails.UpdateCustStatus();objItemDetails.TakeOrder();objItemDetails.BillAmount();}}}
```

##### \

##### Output:

[Customer](https://www.mindstick.com/articles/325839/how-to-improve-your-business-level-of-customer-service) Name is: Jacob

Order Placed

Bill Amount is: 1000

---

Original Source: https://www.mindstick.com/blog/364/interface

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
