Hi All,
I am trying to convert a simple function from vb.net to c# but am runing into problmes.
The vb.net function is
Private Function GetTopValues(ByVal stocks As Dictionary(Of MySymbolScript, Double), ByVal count As Integer) As IEnumerable(Of KeyValuePair(Of MySymbolScript, Double))Return (From stock In stocks Order By stock.Value Descending).Take(count)End Function
and converted to c# I get:
private IEnumerable<KeyValuePair<MySymbolScript, double>> GetTopValues(Dictionary<MySymbolScript, double> stocks, int count)
{
return (from stock in stocks orderby stock.Value descending).Take(count);
}
The problem is at the ) after the word descending it says "Error 1 A query body must end with a select clause or a group clause"
Any ideas? I have treid a few variations but nothing seams to work for me.
Thanks.
James
Loading
Jaganathan BantheswaranPosted Jun 13, 2011, 1:07 AM
(from stock in stocks orderby stock.Value descending select stock ).Take(count);
try this.
James RamsayPosted Jun 17, 2011, 10:00 PM