Can I create a generic method that accept two types. The attributeType
and ts_attributeType
do not share any common parent class although they do have the same fields.
Is this possible? Or is there some way I can achieve this?
private static void FieldWriter<T>(T row)
where T : attributeType, ts_attributeType
{
Console.Write(((T)row).id + "/" + (((T)row).type ?? "NULL") + "/");
}
I have seen this answer from Jon Skeet, however I am not certain if it also applies to my question.
Some further background:
Both attributeType
and ts_attributeType
have been created using the xsd.exe tool; and are are partial classes.