I can create a cast function generically like this:
public IEnumerable<T> Convert<IEnumerable<T>>(object input) {
return (IEnumerable<T>) input; // this works
}
But say, I don't have T, but I have Type. How do I get this to work?:
// object is a List<int>, Type is typeof(int)
public object Convert(object input, Type type) {
return IEnumerable<Type> input; // this does not work
}