Assume the following type definitions:
public interface IFoo<T> : IBar<T> {}
public class Foo<T> : IFoo<T> {}
How do I find out whether the type Foo
implements the generic interface IBar<T>
when only the mangled type is available?
By using the answer from TcKs it can also be done with the following LINQ query:
bool isBar = foo.GetType().GetInterfaces().Any(x =>
x.IsGenericType &&
x.GetGenericTypeDefinition() == typeof(IBar<>));