Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:06:58+00:00 2026-05-28T03:06:58+00:00

I am trying to convert the following LINQ code from C# to VB.NET. Here

  • 0

I am trying to convert the following LINQ code from C# to VB.NET. Here is the C# followed by my attempt at VB. In VB I would like to declare rowList as IEnumerable(Of IGrouping(Of Char, String)) but it returns an IEnumerable(Of IEnumerable(Of Char, String)).

string rows = "ABC";
string cols = "123";
string[] squares = (from r in rows from c in cols select "" + r + c).ToArray();
IEnumerable<IGrouping<Char, String>> rowList = (from r in rows from s in squares where s.Contains(r) group s by r into g select g);


Dim rows As String = "ABC"
Dim cols As String = "123"
Dim squares As String() = (From r In rows From c In cols Select "" & r & c).ToArray()
Dim rowList = (From r In rows From s In squares Where s.StartsWith(r) Group By r Into g = Group Select g).Dump("rowList")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:06:59+00:00Added an answer on May 28, 2026 at 3:06 am

    There are differences between Linq in VB .NET and C#. If you want the return type for the Linq statement in VB .NET to be IEnumerable(Of IGrouping(Of Char, String)) write the Linq statement as follows:

    Dim rowList As IEnumerable(Of IGrouping(Of Char, String)) = 
    (From r In rows From s In squares Where s.StartsWith(r)).GroupBy(Of Char, String)(Function(rowsquare) rowsquare.r, Function(rowsquare1) rowsquare1.s)
    

    This way you’re dealing with a GroupedEnumerable and not an Enumerable of Enumerable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert the following code from OpenGL 1.5 spec. to the OpenGLES
I am trying to convert the following code from msvc to gcc #define ltolower(ch)
I am trying to convert the following line of SQL to LINQ code :
Trying to retrieve data using linq from a database. I would like to use
I am trying to convert the following SQL into a LINQ expression SELECT COUNT(ID)
I have the following Transact-Sql that I am trying to convert to LINQ ...
So I'm a Flash guy and I'm trying to convert the following code to
HI, I am trying to convert the following vba code to c# and i
Working with Sitecore and Linq extensions. I am trying to convert to from an
Im trying to convert following line of VB.NET to C#: Dim langs As New

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.