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

  • Home
  • SEARCH
  • 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 8142677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:53:35+00:00 2026-06-06T12:53:35+00:00

I just looking how to use LINQ for grouping a list. Class Item Public

  • 0

I just looking how to use LINQ for grouping a list.

Class Item
    Public col1 As String
    Public col2 As String
    Public col3 As String
    Public description As String
    Public Sub New(ByVal col1 As String, ByVal col2 As String, 
                   ByVal col3 As String, ByVal description As String)
        Me.col1 = col1
        Me.col2 = col2
        Me.col3 = col3
        Me.description = description
    End Sub
End Class  


    Dim ItemList As New List(Of Item)
    ItemList.Add(New Item("A", "A", "A", "1"))
    ItemList.Add(New Item("A", "A", "A", "2"))
    ItemList.Add(New Item("A", "B", "A", "3"))
    ItemList.Add(New Item("A", "B", "A", "4"))
    ItemList.Add(New Item("A", "B", "B", "5"))
    ItemList.Add(New Item("A", "B", "C", "6"))

Result should be list of 4 items:

    '[0] = "A", "A", "A", "1 2"
    '[1] = "A", "B", "A", "3 4"
    '[2] = "A", "B", "B", "5"
    '[3] = "A", "B", "C", "6"
  • 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-06-06T12:53:36+00:00Added an answer on June 6, 2026 at 12:53 pm

    If I understand your requirement to group by the 3 columns and join their descriptions, the following LINQ statement should work:

    var query = from item in ItemList
                group item by
                    new { Col1 = item.col1, Col2 = item.col2, Col3 = item.col3 }
                into g
                select new
                {
                     Col1 = g.Key.Col1,
                     Col2 = g.Key.Col2,
                     Col3 = g.Key.Col3,
                     Description = String.Join(" ", g.Select(xx => xx.description))
                };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just installed Visual Studio 2008, and am looking to use the Microsoft Intermediate
I was just going to use the FileUpload.FileBytes property but looking into the respective
I didn't use LINQ to SQL in project, I just went through a hand-on
I am looking for a nice simple LINQ query that can get an item
Just looking for a good PHP Image Library, I want to display images with
Just looking on resources that break down how frames per second work. I know
Basically just looking to see if you can capture an image from the webcam
I was just looking at the MySql database created by drupal after I installed
I'm just looking for suggestions on the best way to do this... I need
I'm just looking for a little guidance as to how i might implement a

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.