Should I use `!IsGood` or `IsGood == false`?

后端 未结 30 2522
礼貌的吻别
礼貌的吻别 2020-12-02 19:49

I keep seeing code that does checks like this

if (IsGood == false)
{
   DoSomething();
}

or this

if (IsGood == true)
{
   D         


        
30条回答
  •  感情败类
    2020-12-02 20:32

    Readability only..

    If anything the way you prefer is more efficient when compiled into machine code. However I expect they produce exactly the same machine code.

提交回复
热议问题