I\'m trying to create this generic method to simplify things but I think I messed it up! Can you help with my problem?
This compiles:
private string
You either need to make separate versions:
private string ConcatenateText(MyEntity myEntity)
where T1 : Supplier, new()
where T2 : SupplierDepartment, new()
{
T1 p = new T1();
T2 r = new T2();
return mystring;
}
private string ConcatenateText(MyEntity myEntity)
where T1 : Employee, new()
where T2 : EmployeeDepartment, new()
{
T1 p = new T1();
T2 r = new T2();
return mystring;
}
or need to make them share a base class:
private string ConcatenateText(MyEntity myEntity)
where T1 : EmployeeSuplierBase, new()
where T2 : EmployeeSupplierDeparmentBase, new()
{
T1 p = new T1();
T2 r = new T2();
return mystring;
}
I'd prefer the separate versions, really, because with them they can't call it with Supplier
and EmployeeDeparment
(or vice versa)