Confusing If Statement?

前端 未结 13 880
-上瘾入骨i
-上瘾入骨i 2020-12-20 13:03

I always use If statement (In C#) as (1. Alternative);

if (IsSuccessed == true)
{
   //
}

I know that there is no need to write \"== true\"

相关标签:
13条回答
  • 2020-12-20 13:30

    I would settle for your second option aswell. There is in my opinion no need to write the

    if (IsSuccessed == true) 
    { 
       // 
    } 
    

    In fact, I totally dislike the using of == true for a boolean, since it has no extra value. AND: You have to type less characters, which obviously is an advantage :p. To be honest i would also rewrite the boolean to bSuccessed, since it's a boolean.

    0 讨论(0)
提交回复
热议问题