Skip to content

Instantly share code, notes, and snippets.

Created July 12, 2012 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3097855 to your computer and use it in GitHub Desktop.
Save anonymous/3097855 to your computer and use it in GitHub Desktop.
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