In the list of objects of type
List<Configuracion.Models.v_cCfgDeclaraciones>
I would like retrive the name field, I would like to find the name of the field within the loop (foreach) better if I do not use reflection, how i can resolve this?

In the list of objects of type
List<Configuracion.Models.v_cCfgDeclaraciones>
I would like retrive the name field, I would like to find the name of the field within the loop (foreach) better if I do not use reflection, how i can resolve this?

Put together something on Linqpad. Note that this does use reflection:
void Main() {
Test t = new Test();
Type tType = t.GetType();
foreach (PropertyInfo prop in tType.GetProperties()) {
prop.Name.Dump();
}
}
public class Test {
public string prop1 { get; set; }
public string prop2 { get; set; }
public Test() {
prop1 = "Property 1";
prop2 = "Property 2";
}
}
I don't know of a way you can get this information (short of hard-coding it in) without using reflection. Is there a reason you don't want to use reflection in this case?