 <p>Why are you making this generic? Just overload the method.</p> <pre><code> void bar(A a) { a.Foo(); } void bar(B b) { b.Foo(); } </code></pre> <p>Generics are there so that you can make potentially infinite <code>bar()</code> methods.</p>