C# a == b ? c :d 表示的意思

a==b 为true,这个表达式返回c;

a==b为false,这个表达式返回d.

 

相当于:

if(a == b)

{

  return c;

}

else

{

  return d;

}

posted @ 2018-07-06 15:33  朋丶Peng  阅读(3419)  评论(0)    收藏  举报