How to find out if an object's type implements IEnumerable<X> where X derives from Base using Reflec
- by Dave Van den Eynde
Give a base class "Base", I want to write a method Test, like this:
private static bool Test(IEnumerable enumerable)
{
...
}
such that Test returns true if the type of o implements any interface of IEnumerable where X derives from Base, so that if I would do this:
public static IEnumerable<string> Convert(IEnumerable enumerable)
{
if…