??=
is the null-coalescing assignment operator, which is a new feature in C# 8, which can only run in .Net Core 3 and later versions.
It returns the value of its left-hand operand if it isn't null; otherwise, it evaluates the right-hand operand and returns its result.
int? i = 5;
Console.WriteLine(i ??= 17); //output 5
int? j = null;
Console.WriteLine(j ??= 17); //output 17
We can use the ternary conditional operator to replace it in .Net Framework 4.5.
public DelegateCommand IncrementCommand1
{
get => incrementCommand != null ? incrementCommand : new DelegateCommand(Increment, null, true);
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.