SyntaxDim result As Boolean = object1 Is { object2 | Nothing }
DescriptionThe Is operator compares two object references and indicates whether they refer to the same underlying instance (true) or not (False). It is most often used with If...Then...Else statements, as in: If (someVariable Is someOtherVariable) Then ' ----- Equivalent-specific code here. End If Comparing a variable with Nothing tests whether an instance has not yet been assigned to that variable. If (someVariable Is Nothing) Then ' ----- The variable is undefined. End If Usage at a Glance
Version DifferencesIn .NET, strings and arrays are reference types. In VB 6, strings and arrays are not reference types and, therefore, cannot be used with the Is operator. See AlsoIsNot Operator, TypeOf Operator |