Information.IsNothing(Object) Metodo

Definizione

Restituisce un Boolean valore che indica se a un'espressione non è assegnato alcun oggetto.

public:
 static bool IsNothing(System::Object ^ Expression);
public static bool IsNothing(object Expression);
static member IsNothing : obj -> bool
Public Function IsNothing (Expression As Object) As Boolean

Parametri

Expression
Object

Required. Object espressione.

Valori restituiti

Restituisce un Boolean valore che indica se a un'espressione non è assegnato alcun oggetto.

Esempio

Nell'esempio seguente viene utilizzata la IsNothing funzione per determinare se una variabile oggetto è associata a qualsiasi istanza dell'oggetto.

Dim testVar As Object
' No instance has been assigned to variable testVar yet.
Dim testCheck As Boolean
' The following call returns True.
testCheck = IsNothing(testVar)
' Assign a string instance to variable testVar.
testVar = "ABCDEF"
' The following call returns False.
testCheck = IsNothing(testVar)
' Disassociate variable testVar from any instance.
testVar = Nothing
' The following call returns True.
testCheck = IsNothing(testVar)

Commenti

IsNothing restituisce True se l'espressione rappresenta una variabile oggetto a cui non è attualmente assegnato alcun oggetto; in caso contrario, restituisce False.

IsNothing è progettato per lavorare sui tipi di riferimento. Un tipo di valore non può contenere un valore Nothing e ripristina il valore predefinito se lo si assegna Nothing . Se si specifica un tipo di valore in Expression, IsNothing restituisce Falsesempre .

Si applica a

Vedi anche