Note: I\'ve seen this question asked sometimes before (a, b, c), but neither of these was in C#, nor helpful.
Assume I\'m using the ? :
ternary
You can now achieve this using the Discard operator, if you really want to.
public class Program
{
public static void Main()
{
int r=5;
_ = r==5 ? r=0 : 0;
Console.WriteLine($"{r}");
// outputs 0
}
}
You can now also do
_=Foo() ? Bar() : Baz();
As long as Bar and Baz return the same or convertible type.