Hey All,
I was just wondering if this is possible.
I have a List<x> object, and from this, I need to be able to get x. and then use x's class as the generic type for another method.
ie.
private R GetData<R>() {
//this should get me the type of the generic. ie List<string>, this should return //string
Type listType = data.GetType(). GetGenericArgum ents()[0];
//Call another method with the generic type of the list
MethodB<listTyp e>(args);
}
How can this be done? Right now, I cannot specify the type in MethodB, as I think it wants the class. Is there any way to do this?
Thanks.
I was just wondering if this is possible.
I have a List<x> object, and from this, I need to be able to get x. and then use x's class as the generic type for another method.
ie.
private R GetData<R>() {
//this should get me the type of the generic. ie List<string>, this should return //string
Type listType = data.GetType(). GetGenericArgum ents()[0];
//Call another method with the generic type of the list
MethodB<listTyp e>(args);
}
How can this be done? Right now, I cannot specify the type in MethodB, as I think it wants the class. Is there any way to do this?
Thanks.
Comment