help! Linq query
I am getting error msg on the word Records - Type or namespace could not be found. Please help debugging it, what is missing?
if (ProjDDL1.SelectedItem.Value != "--") results = CustomSearch<Records>(results, s => s.Business == ProjDDL1.SelectedItem.Value);
Method CustomSearch:
private DataTable CustomSearch<TKEY>(DataTable dt, Func<Records, bool> selector)
{
DataTable 开发者_如何转开发results = (dt.AsEnumerable().Where(selector).CopyToDataTable());
return results;
}
Visual Studio will normally underline the item that's erroring when compiled. If you click on it and press Shift-Alt-F10, it will allow you to automatically add the namespace to the code. If you don't get a suggestion, this means that you haven't referenced the DLL that it needs.
Well, if it doesn't know what Records
means, look at your references and using directives. Which namespace is the Records
type in?
Why is your CustomSearch
method generic anyway? It doesn't seem to use TKEY
anywhere...
精彩评论