Information.IsNothing(Object) Metodo

Definizione

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

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

Parametri

Expression
Object

Obbligatorio. Espressione Object.

Restituisce

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

Esempio

Nell'esempio seguente viene usata la IsNothing funzione per determinare se una variabile oggetto è associata a qualsiasi istanza di 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 di oggetto che attualmente non ha alcun oggetto assegnato. In caso contrario, restituisce False.

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

Si applica a

Vedi anche