Click here to Skip to main content
15,616,639 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I am using a book which does not explain about interfaces .
I want to know what a interface really does and I am also using MEF.
Please link me to a good site or give me a good answer.
It also tells me to make an interface but doesn't tell me to create any code in that interface.Is there something that i should type by default or something .
Please let me know.

Thank you.

Did you read what MSDN says about it? It is quite explanatory.[^]
Share this answer
An Interface does not do anything on it's own. You can consider an Interface to be a contract which describes what method(s) with which signature(s) a type has to declare if it wants to fullfill that contract. You can then use an instance of that type in the sure knowledge that it fullfills the contract and the code using that instance does not even have to be aware of that concrete type (See: Programming against interfaces instead of concrete implementations).

An empty Interface can even be used as some kind of marker, even though I think Attributes are better for that most of the time. An interface that does not prescribe any method or property can be added to any type definition as inheriting from it. In your code you can check if a type implements said (empty) interface and if the type does you can do something fitting that situation.

Best Regards,

Share this answer
Manas Bhardwaj 15-May-12 7:52am    
nicely explained :) +5
Manfred Rudolf Bihy 15-May-12 8:05am    
Thank you!

Go through following forum and its responses. It explains Why we need an Interface[^]
Share this answer
According to the MSDN An interface contains only the signatures of methods, delegates or events. (Ref: interface[^])

Please pick one of the link from what is interface in C#[^]
Share this answer
Hope this link will help you..[^]
Share this answer
Well it is an easy thing to find on CodeProject, there are many articles speaking about interfaces.

This is one of them:

Interfaces in C# (For Beginners)[^]

Mike Taulty also made a nice videoas about Interfaces, Prism, MEF.

Check some of them out here:[^][^]


Share this answer
Interface is actually shows special functionality. If you create class A and that class implement interface than we can say that class is differ from other class B because it is using the interface which class B is not so class A has special functionality as compared to other class.

Interfaces in C# (For Beginners)[^]

Share this answer
Prasad_Kulkarni 15-May-12 7:47am    
Link formatted
Sipherz 15-May-12 7:48am    
Thank you guys!!
Its really helpful
Afzal Shaikh 15-May-12 7:55am    
you welcome!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900