Skip to content

Instantly share code, notes, and snippets.

@dfmartin
dfmartin / gist:5703425
Created June 4, 2013 03:44
Comparing Type with GenericType to determine if a type is derived from a generic type where the generic argument type is unknown.
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Assert.IsTrue(typeof(Foo<>).IsAssignableFrom(typeof(Bar))); // fails
}
[TestMethod]