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.

Fix

Convert the ternary expression to a null-coalescing operation.

Purpose

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

Example

private string MyString;
public string GetMyString()
{
    return (MyString == null ? "no value" : MyString);
}

Fix:

private string MyString;
public string GetMyString()
{
    return (MyString ?? "no value");
}