?
Solved

why no need to select in vb.net linq

Posted on 2011-10-28
3
Medium Priority
?
205 Views
Last Modified: 2012-05-12
Hi,

I am in the process of getting to grips with c# having used vb.net for quite some time.

This linq statement in vb:
Dim n = (From cl In GeneralHelper.CostumeGroups Where cl.CostumeGroupID = groupID)

Doesn't need a select at the end to work just fine...

With c# I get an error unless I add the select cl at the end:
dynamic n = (from cl in GeneralHelper.CostumeGroups where cl.CostumeGroupID == groupID select cl);

Why is that?
0
Comment
Question by:scm0sml
3 Comments
 
LVL 21

Expert Comment

by:Craig Wagner
ID: 37048092
I don't know why VB.NET doesn't require the select but C# does, but you should not be using "dynamic" in this situation. Either "var" or "IEnumerable<CostumeGroup>" would be more appropriate.
0
 

Author Comment

by:scm0sml
ID: 37049459
Yeah the code convertor i used did that, have changed now.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 37049499
The "why" might be that there are still two different mindsets for the VB.NET and C# development paths, even though Microsoft merged those two teams into one.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question