有没有办法将 if 语句添加到函数参数中?例如:
static void Main()
{
bool Example = false;
Console.Write((if(!Example){"Example is false"}else{"Example is true"}));
}
//Desired outcome of when the code shown above is
//executed would be for the console to output:
//Example is false
var x = thisIsTrue ? 1 : thatIsTrue ? 2 : 3
等等。 - Nathan Taylor