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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:47:45+00:00 2026-05-12T18:47:45+00:00

I need help in turning this linq expression into a linq statment. SampleData.Publishers and

  • 0

I need help in turning this linq expression into a linq statment. SampleData.Publishers and SampleData.Books are simple collections that I have from the Linq in Action book.

Here is the expression

var pubBooks =
            from pub in SampleData.Publishers
            join book in SampleData.Books on pub.Name equals book.Publisher.Name into pubbks
            select new {
                Publisher = pub.Name,
                Books =
                    from b in pubbks
                    select b.Title
            };

Here is what I have so far, but I can’t seem to get the books collection defined in the anonymous type. Thanks for your time.

var pubBooks = SampleData.Publishers.Join(SampleData.Books, pub => pub.Name, book => book.Publisher.Name, (pub, book) => new {
            Publisher=pub.Name,
            Books=??????
        });
  • 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-12T18:47:45+00:00Added an answer on May 12, 2026 at 6:47 pm

    Resharper gave me this:

    var pubBooks =
                SampleData.Publishers.GroupJoin(
                    SampleData.Books,
                    pub => pub.Name,
                    book => book.Publisher.Name,
                    (pub, pubbks) => new
                                         {
                                             Publisher = pub.Name,
                                             Books =
                                         from b in pubbks
                                         select b.Title
                                         });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help with a query that I wrote: I have three tables Company id
hi im pretty much a beginner.I need some help turning this script in an
I need help turning something like: <img class=coup-pic src=http://example.com/img/pic.jg alt= /> into: <a href=http://example.com/img/pic.jg><img
I just need some help to finish turning this SQL : SELECT us.name, pt.task,
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
Need help writing a script downloads data from google insight using c# this is
need help/guide for sql select query, I have 2 table stock and stock_history, in
need help regarding USSD Gateway. I have to develop an app, which will directly
need help in error in database pivot. i have table tamed table_score like below:
Does anybody know the syntax of turning a list of lists into something that

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.