I have an element type:
public class FieldInfo
{
public string Label { get; set; }
public string Value { get; set; }
}
And I have an array filled with FieldInfo objects.
FieldInfo[] infos = new FieldInfo[]
{
new FieldInfo{Label = "label1", Value = "value1"},
new FieldInfo{Label = "label2", Value = "value2"}
};
Now I want to convert that array to a new one that contains following values:
string[] wantThatArray = new string[] {"label1", "value1", "label2", "value2"};
Is there a short way to do the conversion from an array like infos to an array like wantThatArray?
Maybe with LINQ’s Select?
1 Answer