Need help to optimise my C# code
Well, you could build a dictionary for the temp array but it depends how often the key (index 1 of each temp row) is repeated. If you have very few repetitions then it could reduce the time because it only has to search through a subset of the 1000 temp rows.

Something along these lines:

Dictionary&lt;string, List&lt;string[]&gt;&gt; rowCache = new Dictionary&lt;string, List&lt;string[]&gt;&gt;();

foreach (var row in tempArray)
{
    List&lt;string[]&gt; keyRows;
    string key = row[1];
    if (!rowCache.TryGetValue(key, out keyRows))
    {
        keyRows = new List&lt;string[]&gt;();
        rowCache[key] = keyRows;
    }
    keyRows.Add(row);
}


Then your main loop becomes something like

// little helper method
public List&lt;string[]&gt; GetRows(string key)
{
    List&lt;string[]&gt; rows;
    return rowCache.TryGetValue(key, out rows) ? rows : new List&lt;string[]&gt;();
}


...

foreach (var row in rawArray)
{
    foreach (var srcRow in GetRows(row[0])
    {
       // perform your SRC logic here
    }

    foreach (var dstRow in GetRows(row[1])
    {
       // perform your DST logic here
    }
}


Another major speed improvement can probably be achieved by not using strings for entries which obviously aren't strings. You are doing a lot of double-to-string-and-back conversion which will be slow. If you can convert the input data into double when obtaining it, perform your calculations and then convert it back for output if necessary it should speed things up a lot as well.