I have several classes that serve only for storing data. for instance
public class EntityAdresse : IEntityADRESSE
{
public string Name1 { get; set; }
public string Strasse { get; set; }
public string Plz { get; set; }
public string Ort { get; set; }
public string NatelD { get; set; }
public string Mail { get; set; }
public int Id_anrede { get; set; }
public string Telefon { get; set; }
public int Id_adr { get; set; }
public int Cis_adr { get; set; }
}
This adress. As I said, it contains only data. There are no methods (I know that the interface does not make sense here ...)
Now I need to implement ToString for all of these Entity-Classes, and there are many.
My question is: is there a metaprogramming function in C # that automatically generates these tostring methods? I do not want to write boiler plate code for each of these classes.
Alternatively, I could write a perl or python script to generate the code. But I prefer to do it directly in C #.
source
share