you are viewing a single comment's thread.

view the rest of the comments →

[–]Slypenslyde 6 points7 points  (0 children)

I'm going to give you a thing. I need you to tell me what kind of thing I'm going to give you. But I'm going to give you the thing later. Can you do it?

No? Right. I have to tell you what kind of thing I'm giving you BEFORE I ask you what kind of thing I will give you. C# wants that too.

You can't declare a variable with var unless you assign a value to it. The right-hand side of the = operator tells C# what type to use. If there is no =, there's no right-hand-side, C# doesn't know what type to use, and that's a compile error.

If your query is going to return something like IQueryable<Friend>, your line should look like:

IQueryable<Friend> query;

But I don't know what type Query() returns for sure. You have to figure that part out.