I have 4 static helper methods I want to combine into one if possible. Each method is identical aside from the input parameter data type, and setting a value in the ReturnDto and the ReturnDto type. I'm fairly new to Generics but not even sure if this is doable in an efficient matter other than having 4 strongly typed methods.
private static ReturnDto<int> MethodName(int val)
private static ReturnDto<string> MethodName(string val)
private static ReturnDto<bool> MethodName(bool val)
private static ReturnDto<DateTime> MethodName(DateTime val)
{
//do some stuff here...
return new ReturnDto<DateTime> { Val = val, Val2 = val2, Val3 = val3 };
}