TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
James Ramsay
NA
3
1.5k
vb.net function to C# conversion
Jun 12 2011 9:30 PM
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
Reply
Answers (
2
)
Getting data from host, convert to string and then to bytes
Parsing String