I have the following classes
public interface InterfaceBase { } public class ImplementA:InterfaceBase { } public class ImplementB:InterfaceBase { } public void TestImplementType<T>(T obj) where T: InterfaceBase { }
How to infer what the T is whether ImplementA or ImplementB? I tried to use
typeof(T) is ImplementA
but this expression is always evaluated to false.
Edit: And how am I going to cast obj to ImplementA or ImplementB?
obj is ImplementA