<p>I have the following classes</p>

<pre><code>public interface InterfaceBase
{
}

public class ImplementA:InterfaceBase
{
}

public class ImplementB:InterfaceBase
{
}

public void TestImplementType&lt;T&gt;(T obj) where T: InterfaceBase
{
}
</code></pre>

<p>How to infer what the T is whether ImplementA or ImplementB? I tried to use </p>

<pre><code>typeof(T) is ImplementA
</code></pre>

<p>but this expression is always evaluated to false. </p>

<p>Edit: And how am I going to cast obj to ImplementA or ImplementB?</p>

```
obj is ImplementA
```