C# get distinct values from jagged array
<p>I'm looking for a way to get distinct values from a jagged array.  I've tried putting it in a dictionary, but it doesn't seem to see the values as distinct.  Anyone any ideas for a solution?  Here is what I have so far:</p>

<pre><code>int[][] connectionList = GetArray();
</code></pre>

<p>Sample data returned from this:</p>

<pre><code>[0][1, 130, 136, 138]
[1][1, 78, 126, 138]
[2][1, 10, 125, 138]
[3][1, 130, 136, 138]
[4][1, 78, 126, 138]
[5][1, 130, 136, 138]
[6][1, 72, 135, 138]
[7][1, 73, 135, 138]
[8][1, 130, 136, 138]
</code></pre>

<p>Have tried adding to a dictionary.  I tried to catch duplicate values as they are added, but that didn't work, so tried to add .Distinct(), but no joy there either</p>

<pre><code>Dictionary&lt;int, int[]&gt; myDictionary = new Dictionary&lt;int, int[]&gt;();
for (int i = 0; i &lt; connectionList.Length; i++)
{ 
    List&lt;int&gt; list = new List&lt;int&gt;();
    for (int j = 0; j &lt; connectionList[i].Length; j++)
    {
        list.Add(connectionList[i][j]);        
    }
    if (myDictionary.Where(x =&gt; x.Value == list.ToArray()).Count() == 0)
        myDictionary.Add(i, list.ToArray());
}
var distinctList = myDictionary.Values.Distinct().ToList();
</code></pre>

<p>From the above list, the output I'm looking for would be:</p>

<pre><code>[0][1, 130, 136, 138]
[1][1, 78, 126, 138]
[2][1, 10, 125, 138]
[4][1, 72, 135, 138]
[5][1, 73, 135, 138]
</code></pre>

<p>Any thoughts how I could achieve this?</p>
