I have a class with multiple properties. Each property have type another class.
public class FirstClass
{
public Field Field1 { get; set; }
public Field Field2 { get; set; }
public Field Field3 { get; set; }
public Field Field4 { get; set; }
public Field Field5 { get; set; }
}
Field class will look like this
public class Field
{
public string Label { get; set; }
public string ExternalId { get; set; }
public int FieldId { get; set; }
public string Type { get; set; }
}
Is there a way to get all FieldIds from each Properties in FirstClass?
What i want is like this.
var fieldIds = // go through each fields (Field1 to FieldN) and select FieldId from each property.
Number of properties in FirstClass can be varied time to time. so i can't do it only depending on existing fields. I need to get value from all the fields