I'm iterating through objects that contains an array of doubles. Names changed. Imagine this is an object of Lab samples, and I'm trying to get a flat representation of the Sample object.
From:
Sample
{
public string Name
public string Type
...
public double[] RawReadings
}
To, for example:
Name,
RawRead1,
RawRead2,
RawRead3,
...
RawReadn
How do I finangle sample.RawReadings to give me all n items in the array? I don't care if it's named or not.
Edit for clarity: I want the each item in the resulting list to have the Name and as many doubles as properties in the class as there are RawReads. I do not want each item in the resulting list to have a Name and an array - that'll just be the same as what I had.
Sample LinQ:
from sample in Samples
select new
{
Name = sample.Name,
sample.RawReadings
}
Is this even possible?
Edit: I'm feeding this to a 3rd party API call that's expecting something in a "row and column format". Aspose.Cells ImportCustomObject to be exact. It might be possible to work around it with multiple calls and manually aligning them but that can be tricky and bug prone.