IsNothing versus Is Nothing

后端 未结 9 1521
暗喜
暗喜 2020-11-29 23:51

Does anyone here use VB.NET and have a strong preference for or against using IsNothing as opposed to Is Nothing (for example, If IsNothing(a

9条回答
  •  鱼传尺愫
    2020-11-30 00:14

    I agree with "Is Nothing". As stated above, it's easy to negate with "IsNot Nothing".

    I find this easier to read...

    If printDialog IsNot Nothing Then
        'blah
    End If
    

    than this...

    If Not obj Is Nothing Then
        'blah
    End If
    

提交回复
热议问题