Skip to content

Instantly share code, notes, and snippets.

@mikeminutillo
Created December 5, 2012 04:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeminutillo/4212342 to your computer and use it in GitHub Desktop.
Save mikeminutillo/4212342 to your computer and use it in GitHub Desktop.
Dynamic Dispatch
void Main()
{
DoTheThing(1);
DoTheThing(2);
DoTheThing("Banana");
}
public static void DoTheThing(object o)
{
DoTheThingInternal((dynamic)o);
}
private static void DoTheThingInternal<T>(T item)
{
Console.WriteLine("{0} [{1}]", item, typeof(T).Name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment