Skip to content

Instantly share code, notes, and snippets.

@shanefulmer
Created July 20, 2012 12:33
Show Gist options
  • Save shanefulmer/3150495 to your computer and use it in GitHub Desktop.
Save shanefulmer/3150495 to your computer and use it in GitHub Desktop.
Dynamic Dispatch 1
using System;
using System.Collections.Generic;
public class Foo { }
public class Bar { }
public class Baz { }
public class Program
{
public static void CallMe<T>(T input)
{
Console.WriteLine("typeof(T): {0}", typeof(T));
}
static void Main()
{
var objects = new List<object>();
objects.Add(new Foo());
objects.Add(new Bar());
objects.Add(new Baz());
foreach (var o in objects)
{
Program.CallMe(o);
}
Console.ReadKey();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment