Follow the code:
Model:
public class Usuario
{
public string Campo1 { get; set; }
public string Campo2 { get; set; }
public string Campo3 { get; set; }
public string Campo4 { get; set; }
public string Campo5 { get; set; }
public string Campo6 { get; set; }
public string Campo7 { get; set; }
public string Campo8 { get; set; }
public string Campo9 { get; set; }
public string Campo10 { get; set; }
}
Controller:
var teste = new Usuario();
string texto = ""+teste.Campo1+ teste.Campo2+ etc"";
How can you see the above code, is there an easier way without typing teste
? That is, just type teste
that already fills all fields with their value. Because tomorrow I can have more than 100 fields.
Any solution?