Convert / Cast IEnumerable to IEnumerable <T>
Tengo una clase (un control web) que tiene una propiedad de tipo IEnumerable y me gustaría trabajar con el parámetro usando LINQ.
¿Hay alguna forma de emitir / convertir / invocar mediante reflexión a IEnumerable <T> sin conocer el tipo en tiempo de compilación?
Method void (IEnumerable source)
{
var enumerator = source.GetEnumerator();
if (enumerator.MoveNext())
{
var type = enumerator.Current.GetType();
Method2<type>(source); // this doesn't work! I know!
}
}
void Method2<T>(IEnumerable<T> source) {}