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

后端 未结 30 2494
礼貌的吻别
礼貌的吻别 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 20:51

    I prefer the !IsGood approach, and I think most people coming from a c-style language background will prefer it as well. I'm only guessing here, but I think that most people that write IsGood == False come from a more verbose language background like Visual Basic.

提交回复
热议问题