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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:31:46+00:00 2026-06-15T19:31:46+00:00

I thought that bill + john + null == billjohn , but in this

  • 0

I thought that "bill" + "john" + null == billjohn, but in this example of mine it seems to be evaluating to null:

 var clients = from client in taxPortalService.Client()
                          select new ClientViewModel
                              {                               
                                  ResidentialAddressLine1 = client.RESADDRESSLINE1,
                                  ResidentialAddressLine2 = client.RESADDRESSLINE2,
                                  ResidentialAddressLine3 = client.RESADDRESSLINE3,
                                  ResidentialAddressLine4 = client.RESADDRESSLINE4,
                                  ResidentialPostalCode = client.RESPOSTCODE,
                                  ResidentialCountry = client.RESCOUNTRY,
                                  IAResidentialAddress = client.RESADDRESSLINE1 + ", " + client.RESADDRESSLINE2 + ", " + client.RESADDRESSLINE3 + ", " + client.RESADDRESSLINE4 + ", " + client.RESPOSTCODE + ", " + client.RESCOUNTRY                               
                              };

Am I missing something obvious here?

enter image description here

  • 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-15T19:31:47+00:00Added an answer on June 15, 2026 at 7:31 pm

    In C#, or rather in .NET, you’re right, "bill" + "john" + null gives you "billjohn".

    In SQL, 'bill' + 'john' + null gives you null.

    Using LINQ to Entities translates your C# to SQL, and subtle differences such as this aren’t always preserved.

    You can use the more verbose

    (client.RESADDRESSLINE1 ?? "") + ", " + (client.RESADDRESSLINE2 ?? "") + ", " + ...
    

    to make sure you only concatenate non-null strings, which won’t have this problem.

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

Sidebar

Related Questions

I thought that this was easier… I have a asp:hyperlink control, with target=_blank ,
I thought that layout is just a widget that keeps more widgets inside. But
I thought that I improve performance when I replace this code: def f(a, b):
I just read this answer by Bill Karwin . Note that the $node is
I just wondered how people were approaching this situation. It's something that seems like
I thought that both types would bring you to the root folder, but apparently,
I thought that would have been simple but it is not working. I can,
I thought caseinsensitiveLocalizedCompare: would take care of this (that is not including the and
I have a table with bills. Every bill has an id that comes from
I thought that by convention, only methods with an exclamation mark altered the object.

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.