[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Collapse]CodeRush Classic
  What's New
 [Expand]System Requirements
 [Collapse]Concepts
  [Collapse]Code Analysis
   [Collapse]Code Issues
     Abstract member cannot be declared in nonabstract class
     Abstract member cannot be marked as sealed
     Abstract member cannot be marked as virtual
     Abstract member cannot be private
     Abstract member cannot declare a body
     Anonymous method cannot have 'params' parameter
     Array elements cannot be of static type
     Assignment to global variable
     Base type constructors are not implemented
     Can combine initialization with declaration
     Can declare MVC view
     Can implement base type constructors
     Can initialize conditionally
     Can inline temporary variable
     Can remove type qualifier
     Cannot create an instance of abstract class
     Cannot create an instance of interface
     Cannot create an instance of static class
     Cannot declare instance member in a static class
     Cannot declare variable of static type
     Cannot inherit from sealed type
     Cannot inherit from special class 'System.ValueType'
     Cannot inherit from static class
     Cannot override inherited sealed member
     Cannot yield in the body of a catch clause
     Cannot yield in the body of a finally clause
     Cannot yield in the body of a try block with a catch clause
     Case statement has incorrect range of integers expression (VB)
     Case statements do not explicitly handle all enum values
     Catch block is empty
     Class should implement IDisposable
     Complex Member
     Constant cannot be marked static
     Constructor cannot call itself
     Constructor must declare a body
     Control cannot leave the body of a finally clause
     Declaration can be a constant
     Default branch is missing
     Default Value Can Be Assigned
     Delegate can be replaced with lambda expression
     Delegate cannot be marked static
     Destructor must declare a body
     Duplicate code
     Duplicate local declaration
     Duplicate property declaration
     Empty event handler
     Empty finally block
     Empty namespace declaration
     Empty switch statement
     Environment.NewLine can be used
     Extension method cannot have a parameter array used with 'this' modifier
     Extension method must be defined in a non-generic static class
     Extension method must be defined in a top level static class
     Extern member cannot declare a body
     Field can be made read-only
     Fields should be disposed
     ForEach Action can be called
     Format item index too large
     Generic class cannot derive from Attribute
     Hides declaration from the outer scope
     Implicit variable can be used
     Indexer cannot be static
     Initializer can be used
     Interface cannot contain constructors
     Interface events cannot have add or remove accessors
     Interface expected
     Interface member cannot have a definition
     Keyword 'base' is not valid in a static member
     Keyword this (Me) is not valid in a static member
     Lambda expression cannot have 'params' parameter
     Lambda parameter has redundant type specification
     Member can be static
     Member cannot be sealed because it is not an override
     Member is not implemented
     Member is obsolete
     Member must declare a body because it is not marked abstract or extern
     Member names cannot be the same as their enclosing type
     Method must have a return type
     Nested code can be flattened
     Null coalescing operation can be used
     Only class types can contain destructors
     Operator cannot be abstract
     Operator cannot have 'params' parameter
     Operator must be declared static and public
     Operator must declare a body
     Overloaded unary operator takes one parameter
     Override member cannot be marked as new
     Override member cannot be marked as virtual
     Override member cannot change access rights
     Parameter modifier 'this' should be the first parameter of extension method
     Partial class has only single part
     Partial method cannot have access or the virtual, abstract, override, new, sealed, extern modifiers
     Partial method cannot have out parameters
     Partial method has only single part
     Partial method must be declared within a partial class or partial struct
     Possibly unassigned variable usage
     Property can be auto-implemented
     Property cannot have void type
     Protected member cannot be declared in struct
     Protected member in sealed type will be private
     Redundant base constructor call
     Redundant base qualifier
     Redundant constructor
     Redundant delegate creation
     Redundant destructor
     Redundant else statement
     Redundant field initialization
     Redundant namespace reference
     Redundant private setter
     Redundant sealed modifier
     Redundant String.Format call
     Redundant this qualifier
     Redundant ToString call
     Redundant type qualifier
     Redundant use of this qualifier in the global context
     Sealed class cannot be abstract
     Statement is not terminated
     Static class cannot be abstract
     Static class cannot be sealed
     Static class cannot contain protected member
     Static constructors cannot have access modifiers
     Static constructors must be parameterless
     String.Compare can be used
     String.Format can be used
     Struct cannot contain parameterless constructor
     Suspicious use of the Equal To operator
     Suspicious use of the Unequal To operator
     Suspicious use of this qualifier
     Ternary expression can be used
     The params parameter must be a single dimensional array
     The params parameter must be the last parameter in a formal parameter list
     Try statement without catch or finally
     Type can be moved to separate file
     Type name does not correspond to file name
     Undeclared element
     Undeclared static resource
     Undisposed local
     Unused declaration
     Unused member
     Unused setter
     Unused type parameter
     Virtual member call in constructor
     Virtual member cannot be declared in sealed class
     Virtual member cannot be declared in structures
     Virtual member cannot be private
    DDC - Duplicate Detection and Consolidation
  [Expand]Code Style
   Feature Advisor
   FrictionFree Mode
   Mastering CodeRush Classic Features
  [Expand]Visualization Tools
  [Expand]Navigation
  [Expand]Advanced Selection Tools
  [Expand]Clipboard Tools
  [Expand]Coding Assistance
   Unit Test Runner
 [Expand]Visual Elements
 [Expand]Tool Windows
 [Expand]CodeRush Classic Options
 [Expand]Examples
  Get More Help
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Null coalescing operation can be used

CodeRush Classic shows the Null coalescing operation can be used code issue if a ternary expression can be expressed as a null-coalescing operation.

Expanded Fix

Convert the ternary expression to a null-coalescing operation.

Expanded Purpose

Highlights ternary expressions, which can be expressed as a null-coalescing operation to improve code readability.

Expanded Example

Fix:

Is this topic helpful?​​​​​​​