I have a list of lists of string
List<string> l1 = new List<string>();
l1.Add("i");
l1.Add("k");
List<string> l2 = new List<string>();
l2.Add("f");
l2.Add("a");
pChain = new List<List<string>>();
pChain.Add(l1);
pChain.Add(l2);
...
I want to sort pChain based on the first item of each list (the result should be l2, l1).
I tried pChain.Sort(); but an exception occurs
An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: Failed to compare two elements in the array.