I need to make a general class for transform Tuple data, to Data Set. Is possible to call "unknown data method's" with different return type. For example <Tuple<List<string,int>>, <Tuple<List<int,int>>
and put it in like generic type?
I have a generic Class
static class Helper<T>
{
public static DataSet Transform(T data)
{
...transform logic
return new DataSet();
}
}
And another class, which call different methods, which return different types.
For example, I call a method which returns this type:
Tuple<List<Tuple<long, string, string>>, List<Tuple<long, string, string>>>
and I try to call generic class method Transform and insert specific date type, which I get from method result by GetType()
. But I have a problem with it.
For Example - this work, I set string like generic type and string content.
Helper<string>.Transform("test");
But if I want to use "unknown" type, I don't know, how I put it like date type.
var data = Data.GetData();
var type = data.GetType();
//this doesn't work
Helper<type>.Transform(data);
I hope so my question is clear.
Thanks for your help.