What is the simplest way of testing if an object implements a given interface in C#? (Answer to this question in Java)
This Post is a good answer.
public interface IMyInterface {} public class MyType : IMyInterface {}
This is a simple sample:
typeof(IMyInterface).IsAssignableFrom(typeof(MyType))
or
typeof(MyType).GetInterfaces().Contains(typeof(IMyInterface))