Writing information from a List of KeyValuePairs into a DataRow
I would approach this first by flattening the prices dictionary into a sequence of values eg { Key, Value, Key, Value, Key, Value }.

// This method is returning object for now since I'm not clear what types are in your data row..
IEnumerable&lt;object&gt; Flatten&lt;K, V&gt;(IEnumerable&lt;KeyValuePair&lt;K, V&gt;&gt; pairs)
{
    foreach (var pair in pairs)
    {
        yield return pair.Value;
        yield return pair.Key;
    }
}


Using this I can simply loop over the flattened dictionary and copy the values into the data row:

int offset = 8;
foreach (var x in Flatten(prices))
{
    res[offset++] = x;
}


I suspect there is a far better term than "flatten" for what I'm doing with the dictionary here.