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 6939403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:37:06+00:00 2026-05-27T12:37:06+00:00

I have these objects: Public Class MakeInfo Public Property Name As String Public Property

  • 0

I have these objects:

Public Class MakeInfo
  Public Property Name As String
  Public Property Description As String
  Public Property Stock As StockInfo
End Class

Public Class ModelInfo
  Public Property Make As String
  Public Property Name As String
  Public Property Description As String
  Public Property Stock As StockInfo
End Class

Public Class StockInfo
  Public Property Count As Integer
  Public Property MinPrice As Double
End Class

Using LINQ I need to take a List(Of MakeInfo) and a List(Of ModelInfo) and aggregate the StockInfo from ModelInfo into the List(Of MakeInfo).

So for each MakeInfo I will have a total count of all stock where MakeInfo.Name = ModelInfo.Make, and also a minimum price.

I think it’s going to be something like this, but I’m having trouble accessing the nested object and not sure if it’s going to be possible with a single query. I’ve tried a few variations, but here’s where I’m up to:

newList = From ma In makeData _
          Group Join mo In modelData _
          On ma.Name Equals mo.Make _
          Into Group _
          Select New MakeInfo With {.Name = m.Name, _
                                    .Description = m.Description, _
                                    .Stock = ?}
  • 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-27T12:37:06+00:00Added an answer on May 27, 2026 at 12:37 pm

    I eventually found the right way to do this and it doesn’t require loop iteration:

    Dim new_makes = From ma In makes
                    Join mo In models On mo.Make Equals ma.Name
                    Group By ma.Name, ma.Description
                    Into TotalCount = Sum(mo.Stock.Count), LowestPrice = Min(mo.Stock.MinPrice)
                    Select New MakeInfo With {.Name = Name, _
                                              .Description = Description, _
                                              .Stock = New StockInfo With {.Count = TotalCount, .MinPrice = LowestPrice}}
    

    I was certain that it would be possible.

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

Sidebar

Related Questions

I have a simple object as such: public class Info { public string Name
I have this weird situation. I have these two classes: Public Class Entry End
I have these data transfer objects: public class Report { public int Id {
I have this ServiceContract [OperationContract(IsOneWay=true)] void ProcessMessage(Message message); and these objects [DataContract] public class
I have a class that creates several IDisposable objects, all of these objects are
I have the following nhibernate mapping <class name=Customer> <id name=Id> <generator class=native/> </id> <property
I have two objects: public class ParentObject { // some basic bean info }
I have the following database tables/EF objects public class Transaction { //some other properties
I have 2 Hibernate classes in a Spring-driven Application like these: @Entity public class
I have a class along the lines of: public class Observation { private String

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.