As an example, if I inspect an object the following type:
public class LookupList<K, T> : IList<T>, IDictionary<K, T>
How would I look up the type corresponding to the generic argument for IList<>? In this case just retrieving GetGenericArguments will return an array of the two types K and T, and it's unclear which is the argument to IList. So what I'd really like to be able to do is test the object to see if it implements IList<> ( i.e. typeof(IList<>).IsInstanceOfType(myObject) ), and then if so retrieve just the IList<> type so I can then retrieve the generic type.
Is that clear? What's the right call?
Thanks in advance!