I have a list of a class MyData which holds byte arrays. I am creating a function to which I can pass List and a string to access the fields and do some operations on them - primarily concatenation.
The part I am struggling with is accessing a class field via string. I am unsure if I should be using Linq or reflection or a combination of the two.
I have a lot of data, so performance is also a consideration.
Thanks
public class MyData
{
    public byte[] vertices;
    public byte[] indicies;
}    
public byte[] ProcessData(List<MyData> inData, string fieldName)
{          
    byteArray = new byte[inData.Sum(x => x."fieldName").Length];
    offset = 0;
    for (int i = 0; i < inData.Count; i++) {
        Buffer.BlockCopy(inData[i]."fieldName", 0, ret, offset, inData[i]."fieldName".Length);
        offset += inData."fieldName".Length;
    }
    return byteArray;
}
List<MyData> AllMyData = new List<MyData>();
//Load some data (omitted) 
var AllVertices = ProcessData(AllMyData, "vertices"); 
var AllIndicies = ProcessData(AllMyData, "indicies"); 
 
     
    