I have a sorting extension method with the following signature:
public static IEnumerable<T> CustomSort<T>(this IEnumerable<T> source, string sortProperties)
We wrote it a while back and it has been doing its thing. Now I am creating a custom control and the DataSource property is an IEnumerable (non-generic).
Is there any way to get the type of the objects in a non-generic IEnumerable?
I am sure the problem of “sort a custom control data source” has been solved a million times, but I just can’t seem to find a solution.
You could create an extension method that will return the correct type at runtime:
Update: I’ve added the mechanism that I would use to perform the generic-specific
IEnumerable<T>sorting on the non-genericIEnumerable