Microsoft
Software
Hardware
Network
Question : Convert LINQ in C# to VB.NET
Hi all,
I am converting some code from C# to VB.NET but I'm having some trouble with LINQ.
The following is a line a code I wish to convert:
var page = db.Pages.Single
(p => p.ID == NewPageId);
After converting I get the following line:
Dim page = db.Pages.[Single](Of Page)(Function(p) p.ID = NewPageId)
Whe I do this I get the following error:
Overload resolution failed because no accessible 'Single' accepts this number of type arguments.
Any help is greatly appreciated!
Thank you.
Answer : Convert LINQ in C# to VB.NET
it is because two curly braces, remove one
public static void main(String[] args){
{ //REMOVE THIS
Random Solutions
How to change @@servername?
How can "duplicate key" errors be handled easily?
Using VBA to transfer CSV in AC07
Remote Web Workplace does not work outside the LAN
How do I set up Exchange 2007 Activesync to work with PDAs that can sync to Exchange Server
Correct syntax for SQL between-like query
Any free software for getting stats reports from Print servers.
Is there a cmd to see active sessions in SQL 2005?
jucheck.exe on windows 7
Delete a subkey