Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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 15-May-12 2:30am
Sipherz450
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Did you read what MSDN says about it? It is quite explanatory.
 
http://msdn.microsoft.com/en-us/library/ms173156(v=vs.110).aspx[^]
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

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
  Permalink  
v2
Comments
Manas Bhardwaj at 15-May-12 7:52am
   
nicely explained :) +5
Manfred R. Bihy at 15-May-12 8:05am
   
Thank you!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

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[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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#[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hope this link will help you..
 
http://mindprod.com/jgloss/interfacevsabstract.html[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

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,
  Permalink  
v2
Comments
Prasad_Kulkarni at 15-May-12 7:47am
   
Link formatted
Member 8753169 at 15-May-12 7:48am
   
Thank you guys!!
Its really helpful
afzal82 at 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)

  Print Answers RSS
0 DamithSL 295
1 OriginalGriff 214
2 BillWoodruff 170
3 Zoltán Zörgő 165
4 Maciej Los 113
0 OriginalGriff 7,760
1 DamithSL 5,874
2 Sergey Alexandrovich Kryukov 5,444
3 Maciej Los 5,076
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 15 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100