Click here to Skip to main content
15,867,453 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.
Posted

Did you read what MSDN says about it? It is quite explanatory.

http://msdn.microsoft.com/en-us/library/ms173156(v=vs.110).aspx[^]
 
Share this answer
 
v2
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,

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

Go through following forum and its responses. It explains Why we need an Interface
http://www.dotnetspider.com/forum/13184-OOPS-Why-we-need-an-Interface.aspx[^]
 
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..

http://mindprod.com/jgloss/interfacevsabstract.html[^]
 
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:

http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/10/27/prism-and-silverlight-screencasts-on-channel-9.aspx[^]

http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/12/31/silverlight-4-screencasts-the-managed-extensibility-framework-mef.aspx[^]


Etc.

Cheers
 
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)[^]

Thanks,
 
Share this answer
 
v2
Comments
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