How do I append string to a type name then pass it as another type? Here is an example:
public T Get<T>(int id)
{
return dbAccess.Get<T>(id);
}
If I call this method like
SomeObject.Get<Class1>(1234);
I would like to change Class1 to be Class1Data by appending the string “Data” to any passed class, so the dbAccess.Get method would take the object as Class1Data as a conversion of Class1.
Something like this would work:
In case your XxxData object don’t inherit from Xxx, you may want to do some automapping before returning the result.
Then you would have to replace the last line to: