IsNot Operator

The IsNot operator lets you compare two object references. This operator returns False if both objects refer to the same object; otherwise, it returns True. This is equivalent to using Not with the Is operator, but it makes your code easier to read. In Listing 4.6, both If statements behave in the same way, but the If statement that uses the IsNot operator is much easier to read.

Listing 4.6. Comparing the Is and IsNot operators

Dim explorer As Outlook.Explorer = Me.ActiveExplorer()

If Not explorer Is Nothing Then

'Add code to customize the active explorer. End If

If explorer IsNot Nothing Then

'Add code to customize the active explorer. End If

0 0

Post a comment