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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:25:12+00:00 2026-05-22T20:25:12+00:00

I have a Question (q) with many Answers, each Answer has a variety of

  • 0

I have a Question (q) with many Answers, each Answer has a variety of Texts, differing in language. I want to write a query to return all the answers in a given language (Lang) but I’m having difficulty figuring it out… here’s what I’m trying:

List<string> Answers = q.Answers
   .Select(x => x.Texts.Where(l => l.Language.ISO == Lang).Select(t => t.Value))
   .ToList();

which generates:

Cannot implicitly convert type 'System.Collections.Generic.List<System.Collections.Generic.IEnumerable<string>>' to 'System.Collections.Generic.List<string>'

maybe I can’t have a select inside a select… and:

List<string> Answers = q.Answers
   .Select(x => x.Texts.Where(l => l.Language.ISO == Lang))
   .Select(t => t.Value)
   .ToList();

where I would have thought the first select returns a Text, which means the second select can find its .Value… but, no:

'System.Collections.Generic.IEnumerable<Website.Models.Text>' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'System.Collections.Generic.IEnumerable<Website.Models.Text>' could be found (are you missing a using directive or an assembly reference?)

…perhaps I’m close but I can’t quite get it. how does one do this?

— Edit —

the credit here goes to SLaks. Here’s the final statement:

List<string> Answers = q.Answers
        .SelectMany(x => x.Texts)
        .Where(x => x.Language.ISO == Lang)
        .Select(x => x.Value)
        .ToList();
  • 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-22T20:25:13+00:00Added an answer on May 22, 2026 at 8:25 pm

    You need to call .SelectMany() to flatten the list of sets of Texts (IEnumerable<IEnumerable<string>>) into a single set of Texts (IEnumerable<string>).

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

Sidebar

Related Questions

I have a simple question. Of course it has many answers but I cannot
So, this question has been asked lots, and i have seen many different answers,
I have seen many answers for this type of question but its not related
I have read many answers to questions about dynamically resizing NSWindows and nothing has
My question is in relation this this answer. https://stackoverflow.com/a/8773953/1297775 I have read at many
I have checked many questions here but none has my answer. I appreciate if
I have two tables pertaining to this question: conversations has many messages . The
I have these model: class Question has_many :answers end class Answer belongs_to :question end
I have 3 tables: tbl_question (id,question) tbl_answer (id,answer) question_has_answer (id,question_id,answer_id) It looks like many-to-many
This question has been brought up before, and I have searched many of the

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.