I defined a structure:
public struct STRUC
{
public int field1;
public int field2;
...
public int fieldn;
}
Now, I have a list of this struct List<STRUC> l; and I want to create an array taking the field2 from each STRUC in the list l.
For sure with an easy for-loop I’m done:
int [] arr = new int[l.Count];
for(int i=0; i<l.Count; i++)
{
arr[i] = l[i].field2;
}
but I would like to do it with a lambda.
You just need
SelectandToArray: