microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.34k stars 2.21k forks source link

Please support more unary/binary operator operations. #1444

Closed zakean closed 4 weeks ago

zakean commented 4 weeks ago

I hope for the addition of more unary/binary operator functionalities, such as a more concise if statement.

Normal usage:

if(bCondition)
{
    someVar = "Hello";
}

More concise:

if(bCondition)
    someVar = "Hello";

But I hope for support for the following syntax:

bool bCondition = true;
object obj = null;

bCondition??someVar = "Hello";
obj??bCondition= false;
(!bCondition)??someVar = "No";
WeihanLi commented 4 weeks ago

This relates to the C# language, you may want to create an issue in https://github.com/dotnet/csharplang/issues

zakean commented 4 weeks ago

This relates to the C# language, you may want to create an issue in https://github.com/dotnet/csharplang/issues

Opps, sorry about that. I'll go ahead and create an issue in the C# language repo right away