What is interface in C#?

 Posted by Goud.Kv on 9/15/2014 | Category: C# Interview questions | Views: 679 | Points: 40
Answer:

interface is the C# keyword which carries the signatures of methods, events, properties etc. These can be used from the class or struct which implements that interface.
Example,
interface MyInterface

{
void MyMethod();
}

class MyClass : MyInterface
{
void MyInterface.Mymethod()
{
..........;
}

static void Main()
{
...........;
..........;
}
}
By using interfaces, programs become more compact and very easier to maintain.


Asked In: Spotted While Learning | Alert Moderator 

Comments or Responses

Login to post response