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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:35:26+00:00 2026-05-25T03:35:26+00:00

I found this article on the webs and thought I’d try to apply the

  • 0

I found this article on the webs and thought I’d try to apply the null string style method to my excel range value. Sometimes it has a value in it and sometimes it doesn’t and obviously double doesn’t like null values.

This is my little snippet.

double valTotal = (rngTotal.Value != null ? 1 : 0);

My question is what am I doing with this above code? It looks like an if statement in one line with the “1” being the “then” and the “0” being the “else”. Is that right? And most importantly, what is the name of this syntax so I can find out more about this?

  • 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-25T03:35:27+00:00Added an answer on May 25, 2026 at 3:35 am

    It’s the conditional operator. (Sometimes incorrectly called the ternary operator; it’s a ternary operator as it has three operands, but its name is the conditional operator. If another ternary operator is ever added to C#, “the ternary operator” will become an ambiguous/non-sensical phrase.)

    Quick description:

    The first operand is evaluated, and if the result is true, the second operand is evaluated and forms the overall value of the expression. Otherwise the third operand is evaluated and forms the overall value of the expression.

    There’s a little more detail to it in terms of type conversions etc, but that’s the basic gist.

    Importantly, the first operand is always evaluated exactly once, and only one of the second or third operand is evaluated. So for example, this is always safe:

    string text = GetValueOrNull();
    int length = text == null ? 5 : text.Length;
    

    That can never throw a NullReferenceException as text.Length isn’t evaluated if text == null is true.

    It’s also important that it’s a single expression – that means you can use it in some places (such as variable initializers) where you couldn’t use the if/else equivalent.

    Closely related is the null-coalescing operator which is also worth knowing about.

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

Sidebar

Related Questions

I found this article here on how to deregister styles in wordpress. techotronic.de/how-to-de-register-style-sheet-wordpress/ Pretty
I found this article: http://www.deluxeblogtips.com/2010/05/editor-style-wordpress-30.html I created a child theme using the Twentyten theme
I found this article on how to manipulate the rendering sequence of asp.net controls.:
I've found this MSDN article that explains how to monitor processes and services with
I found this in an article on Multithreaded Apartments, but can’t find a definition
I read This article and i found it interesting. To sum it up for
I found this on net in google search and see article here: http://www.thatcssguy.com/limit-your-divs/ See
I've found an article on this subject by a Microsoft employee, but has anyone
I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2
I found this article on partial evaluation which looked pretty cool: (the long link

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.