This documentation is archived and is not being maintained.

IsReference Function

Returns a Boolean value indicating whether an expression evaluates to a reference type.

Public Function IsReference(ByVal Expression As Object) As Boolean

Parameter

Expression
Required. Object expression.

Remarks

IsReference returns True if the expression represents a reference type, such as a class instance, a String type, or an array of any type; otherwise, it returns False.

A reference type contains a pointer to data stored elsewhere in memory. A value type contains its own data.

Example

This example uses the IsReference function to check if several variables refer to reference types.

Dim MyArray(3) As Boolean
Dim MyString As String
Dim MyObject As Object
Dim MyNumber As Integer
MyArray(0) = IsReference(MyArray)   ' Returns True.
MyArray(1) = IsReference(MyString)   ' Returns True.
MyArray(2) = IsReference(MyObject)   ' Returns True.
MyArray(2) = IsReference(MyNumber)   ' Returns False.

Requirements

Namespace: Microsoft.VisualBasic

Module: Information

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

IsArray Function | IsDate Function | IsDBNull Function | IsError Function | IsNothing Function | IsNumeric Function | Object Data Type | TypeName Function

Show: