You haven’t declared any properties – you’ve declared fields. Here’s similar code with properties:
public class DocumentA
{
public string AgencyNumber { get; set; }
public bool Description { get; set; }
public bool Establishment { get; set; }
public DocumentA()
{
AgencyNumber = "";
}
}
I would strongly advise you to use properties as above (or possibly with more restricted setters) instead of just changing to use Type.GetFields
. Public fields violate encapsulation. (Public mutable properties aren’t great on the encapsulation front, but at least they give an API, the implementation of which can be changed later.)