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
IIF query using Like *
launch MS mail merge wizard via code
failure to convert ???
Access Inserting report headers
Event ID 36886...New DC
Awstats running multiple hosts (error)
Running low on System Resources
XenServer with two NICs on two LANs, trouble with networking
SQL View to show the data using PIVOT
Excel / VBA: Code must check if there is any Cell in some filtered rows highligthed in RED...If so code must not run.