“Not … Is Nothing” versus “… IsNot Nothing”

前端 未结 5 1738
夕颜
夕颜 2020-12-29 03:33

Does anyone here use VB.NET and have a strong preference for or against using Not foo Is Nothing as opposed to foo IsNot Nothing? If so, why?

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 03:57

    The

    If Not var1 Is Nothing Then
    

    Is a hangover from VB6. There didn't used to be an IsNot, and so this was the only way to determine if a variable was not Nothing. It seems to be redundant in VB.NET.

提交回复
热议问题