title: Getting type arguments of generic interfaces that a class implements
body: <p>I have a generic interface, say IGeneric. For a given type, I want to find the generic arguments which a class imlements via IGeneric.</p>
  
  <p>It is more clear in this example:</p>
  
  <pre><code>Class MyClass : IGeneric&lt;Employee&gt;, IGeneric&lt;Company&gt;, IDontWantThis&lt;EvilType&gt; { ... }
  
  Type t = typeof(MyClass);
  Type[] typeArgs = GetTypeArgsOfInterfacesOf(t);
  
  // At this point, typeArgs must be equal to { typeof(Employee), typeof(Company) }
  </code></pre>
  
  <p>What is the implementation of GetTypeArgsOfInterfacesOf(Type t)?</p>
  
  <p>Note: It may be assumed that GetTypeArgsOfInterfacesOf method is written specifically for IGeneric.</p>
  
  <p><strong>Edit:</strong> Please note that I am specifically asking how to filter out IGeneric interface from all the interfaces that MyClass implements.</p>
  
  <p>Related: <a href="https://stackoverflow.com/questions/1121834/finding-out-if-a-type-implements-a-generic-interface">Finding out if a type implements a generic interface</a></p>