Created
July 12, 2012 12:38
-
-
Save anonymous/3097855 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IFoo { void Method(); } | |
class Foo : IFoo { public void Method() { Console.WriteLine(“hello”); } } | |
// Interface | |
class FooUser1 { | |
void MethodUser(IFoo foo) { foo.Method(); } | |
} | |
// Generic | |
class FooUser2<T> where T : IFoo { | |
void MethodUser(T foo) { foo.Method(); } | |
} | |
// Delegate | |
internal delegate void MyDelegate(); | |
class FooUser3 { | |
void MethodUser(MyDelegate fooMethod) { fooMethod(); } | |
} | |
… |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment