Is

From Xojo Documentation

Revision as of 20:29, 21 November 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Operator

Compares two object references to determine whether they both refer to the same object.

Usage

result = object1 Is object2

Part Type Description
result Boolean Any container expecting a boolean value.
object1 Object Any object name.
object2 Object Another object name.

Notes

The Is operator returns True if object1 and object2 actually refer to the same object. It checks identity, not contents, so it is not affected by the presence of a comparison operator. Use it the same way as the = operator.

Sample Code

In the following example, the Is operator returns True.

Var d1 As New Dictionary
Var d2 As Dictionary

d2 = d1

If d1 Is d2 Then
// d1 and d2 are the same reference
Else
// d1 and d2 are not the same reference
End If

See Also

IsA operator.