Two For Loops for Adding Queue Items to Datatable

Hi all,

I’m having a little trouble with something that seems trivial and maybe someone knows a more elegant way. I have the following:

ColumnHeaders is a String - (let’s say with 50 items, ie: “time”, “project”,…“status”, “id”)
PreviousQueued is IEnumberable - (queue items in Orchestrators, ie: “Q1”, “Q2”, “Q3” with the above headers)
ArrayRow is Object - this is what I want to use add to a datatable

I know I can add data row with the following:
ArrayRow = {Q1.SpecificContent(“time”).ToString, Q1.SecificContent(“project”)…}
but it would take 50 times to fill out.

I want to cycle through all the queue items Q1, Q2, Q3 with all the Specific headers time, project, status,… i’d want something like the following:

Add Data Row = {PreviousQueued.ElementAt(queuecounter).SpecificContent(““columnheader(columncounter)””).ToString}

I’m stuck on getting the two for-loops working as I’m not sure which should loop first, or is there a better way like using Linq? The concept is to grab the previously queued items and compare it to the current input, find and remove duplicates (hence adding to datatable) and then submit to queue. As the queue items can have different headers, I want to grab those (columnheaders) through a loop and then add to the SpecificContent section in the ArrayRow.

Hope that made sense, thanks for reading.