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
Connecting a remote server (Windows 2000) to a remote main server (Windows 2003 Standard)
dd & flar create : syntax to use with pipe (|), gzip & ssh needed
PerformancePoint error - Cannot connect to data source
ADO connecting to access database - no named arguments
What is the Best Way to Setup Microsoft Access Record Navigation?
programmatically work with object data source and report viewer
SharePoint Services Site Image
Using Rich Text Box
SQL criteria applied to nested queries
Data Validation with VBA without use of worksheet cells