About 197,000 results
Open links in new tab
  1. ?: operator - the ternary conditional operator - C# reference

    Jul 25, 2023 · The conditional operator ?:, also known as the ternary conditional operator, evaluates a Boolean expression and returns the result of one of the two expressions, …

  2. c# - ?: ?? Operators Instead Of IF|ELSE - Stack Overflow

    The ?? operator is called the null-coalescing operator and is used to define a default value for a nullable value types as well as reference types. It returns the left-hand operand if it is not null; …

  3. C# ?: Ternary Operator (Conditional Operator)

    Jun 24, 2020 · The ternary operator starts with a boolean condition. If this condition evaluates to true then it will execute the first statement after ?, otherwise the second statement after : will …

  4. Conditional Operator in C# - Simplifying Your Code

    Aug 3, 2019 · Conditional operator (?:) in C# is used as a single line if-else assignment statement, it is also known as Ternary Operator in C#. It evaluates a Boolean expression and on the basis …

  5. Trying to understand ?. (null-conditional) operator in C#

    Jun 29, 2016 · The > operator is defined for nullable integers so that if the int? has no value (is null), the comparison will return false. In your second example ( a?.B ) a bool? is returned …

  6. Conditional Operator in C# with Example

    Conditional operator (?:) is the only ternary operator available in C# which operates on three operands. The symbol “?” placed between the first and the second operand , and ” : ” is …

  7. c# - Using the ternary operator for multiple operations - Stack Overflow

    Mar 8, 2012 · The conditional operator, which is a ternary operator (not a unary operator), is not a replacement for an if statement. It is an operator that returns one of two results. While you can …

  8. C# Conditional Expressions (Ternary Operator) | Useful Codes

    Jan 1, 2025 · In this article, you can get training on the C# conditional expressions, specifically focusing on the ternary operator. This operator is a powerful feature that allows for concise …

  9. C#'s conditional operator (?:) explained • TradingCode - Kodify

    Dec 11, 2022 · The conditional operator (?:) is like a shorthand, inline if/else statement. This operator, sometimes also called the ternary operator , has the following default syntax (Liberty …

  10. C# ternary (? :) Operator (With Example) - Programiz

    This operator takes 3 operand, hence called ternary operator. Example 1: C# Ternary Operator using System; namespace Conditional { class Ternary { public static void Main(string[] args) { …

Refresh