本章节主要来讲解关于运算和类型转换的一些问题。
5.1 条件运算符
条件运算符(?:)也成为三元运算符,也就是if..else结构的简化形式。其语法:condition? true_value:false_value下面给出列子来
int x = 1;
string s = x + " ";
s += (x == 1 ? "Man" : "Men");
Console.WriteLine(s);
string s = x + " ";
s += (x == 1 ? "Man" : "Men");
Console.WriteLine(s);