I am creating a C# 2010 application using .NET Framework 3.5.
I have a datagridview that contains a few columns and rows [obviously]. I save this datagridview's rows in a structure of the form List<string[]>. I also have a List<double> which contains coefficients. I want to sort the structure by the coefficients using the System.LINQ library. I have attempted the following:
var linq_Query_rowrates = from rw in rows orderby matchrate descending select rw;
This underlines the rows in the query and shows the following error:
Error 1 Could not find an implementation of the query pattern for source type '
System.Collections.Generic.List<string[]>'. 'OrderByDescending' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
Is it possible to sort this kind of structure using the LINQ library and if yes, how?
Note: I am aware of a lot of other methods to accomplish this, I am just interested in doing it using the LINQ library.
Note: matchrate is not a member of rows but using a member of rows does not work either.
LATER EDIT: Maybe it should be something like this?
var linq_Query_rowrates =
from rw in rows
join rate in matchrate
on matchrate equals rows
orderby matchrate descending
select rw;
using System.Linq;directive in your source file?