---
title: "what is interface in c# how to use."  
description: "what is interface in c# how to use."  
author: "Anonymous User"  
published: 2015-11-23  
updated: 2015-11-23  
canonical: https://www.mindstick.com/forum/33626/what-is-interface-in-c-sharp-how-to-use  
category: ".net"  
tags: ["c#", ".net", "interface"]  
reading_time: 1 minute  

---

# what is interface in c# how to use.

I want to know What is [Interface](https://www.mindstick.com/articles/12101/interfaces-in-java-extending-interfaces) and how to use interface please help me.

## Replies

### Reply by Anonymous User

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 implement all properties and events methods.

```
using System.Collections.Generic;using System.Linq;using System.Text;using System;namespace InterfaceApplication{    public interface ITransactions    {        // interface members        void ViewTransaction();        double GetTransactionAmount();    }    public class Transaction : ITransactions    {        private string TransactionCode;        private string TransactionDate;        private double TransactionAmount;        public Transaction()        {            TransactionCode = " ";            TransactionDate = " ";            TransactionAmount = 0.0;        }        public Transaction(string Code, string Date, double Amount)        {            TransactionCode = Code;            TransactionDate = Date;            TransactionAmount = Amount;        }        public double GetTransactionAmount()        {            return TransactionAmount;        }        public void ViewTransaction()        {            Console.WriteLine("TransactionCode: {0}", TransactionCode);            Console.WriteLine("TransactionDate: {0}", TransactionDate);            Console.WriteLine("TransactionAmount: {0}", GetTransactionAmount());            Console.WriteLine();        }    }    class Manager    {        static void Main(string[] args)        {            ITransactions t1 = new Transaction("001", "8/10/2012", 78900.00);            ITransactions t2 = new Transaction("002", "9/10/2012", 451900.00);            t1.ViewTransaction();            t2.ViewTransaction();            Console.ReadKey();        }    }} 
```

```

```


---

Original Source: https://www.mindstick.com/forum/33626/what-is-interface-in-c-sharp-how-to-use

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
