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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:16:26+00:00 2026-06-06T08:16:26+00:00

So I have this Query: var list = (from x in xList join a

  • 0

So I have this Query:

   var list = (from x in xList 
                 join a in AList on x.commonfield equals a.commonfield
                 join b in BList on x.newCommonField equals b.newCommonField
                 from c in Clist.Where(p=>p.connectorID==x.connectorID).DefaultifEmpty()
                                select new { x, a.DesiredFieldFromA, b.DesiredFieldFromB,c.name}).ToList();

    list.ForEach(el =>
                    {
                        el.x.DesiredFieldFromA= el.DesiredFieldFromA;
                        el.x.DesiredFieldFromB= el.DesiredFieldFromB ;
                        el.x.Name=el.name;
                    });
    return list.Select(p=>p.x);

when I do :

select new { x, a.DesiredFieldFromA, b.DesiredFieldFromB,c.name}).ToList();

Question#1: How can I tell it that it should still show me the record … but put string.empty if the name field is null.
Something along :

select new { x, a.DesiredFieldFromA, b.DesiredFieldFromB,c.name??string.Empty}).ToList();

Question#2: How can i tell it that even if “connectorID” is null .. i still need it to show the x record
Thanks in advance!

Solution for #1 and #2 was as follows :

from c in Clist.Where(p=>p.connectorID==x.connectorID).DefaultifEmpty()
                                select new { x, a.DesiredFieldFromA, b.DesiredFieldFromB,name= (c==null) ?"Not Defined": c.name}).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-06-06T08:16:28+00:00Added an answer on June 6, 2026 at 8:16 am

    For Question #1, try this:

    select new { 
        x, 
        a.DesiredFieldFromA, 
        b.DesiredFieldFromB, 
        name = c.name ?? string.Empty
    }).ToList();
    

    You need to specify the name “name” so you can use your expression to assign it.

    For question #2, refer to jonnyGold’s answer.

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

Sidebar

Related Questions

I have this query: var list = (from t1 in context1.SomeTable join t2 in
I have this query var hql = @from Table1 tbl1 left join fetch tbl1.Table2;
I have this following IEnumerable LINQ query: var query = from p in Enumerable.Range(2,
I have this query this.FixturePartidoPuntaje.Load(); var partidos = from q in this.FixturePartidoPuntaje where (
I have a Linq query that looks something like this: var query = from
I have this nhibernate query: var q = NHibernateSession.Current.CreateSQLQuery ( @SELECT LastestEvents.* FROM (
I have this query SELECT articles.*, users.username AS `user` FROM `articles` LEFT JOIN `users`
I have the following LINQ query: List<FileInputItem> inputList = GetInputList(); var results = from
I have a query : var list_transaction = from i in Dt.Transactions join c
I have this simple query -> var games = from p in _oListGames where

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.