I have 3 classes, all share similar properties. 3 of the properties are named exactly the same across all 3 classes. Rather that write 3 methods (one for each class) is there some way I can utilise generics here?
public static String GetAString(ActivityMedia activityMedia)
{
return activityMedia.name;
}
public static String GetAString(AuditMedia auditMedia)
{
return auditMedia.name;
}
public static String GetAString(VehicleMedia vehicleMedia)
{
return vehicleMedia.name;
}
EDIT: Obviously with the aim of simply passing an object of one of those 3 class types to GetAString()