Created
December 5, 2012 04:52
-
-
Save mikeminutillo/4212342 to your computer and use it in GitHub Desktop.
Dynamic Dispatch
This file contains hidden or 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
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