I need to make 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 diferent methods, which return diferents types.
For example i call method which return this type: Tuple<List<Tuple<long, string, string>>, List<Tuple<long, string, string>>>
and i try to call geneeric class method Transform and insert specific date type, which i get from method result by GetType()
. But i have 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.
Aucun commentaire:
Enregistrer un commentaire