Information.IsNothing(Object) Méthode

Définition

Retourne une valeur Boolean indiquant si aucun objet n'est assigné à une expression.

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

Paramètres

Expression
Object

Obligatoire. Expression Object.

Retours

Retourne une valeur Boolean indiquant si aucun objet n'est assigné à une expression.

Exemples

L’exemple suivant utilise la IsNothing fonction pour déterminer si une variable objet est associée à un objet instance.

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)

Remarques

IsNothing retourne True si l’expression représente une variable objet qui n’a actuellement aucun objet affecté ; sinon, elle retourne False.

IsNothing est destiné à travailler sur les types de référence. Un type valeur ne peut pas contenir la valeur Nothing et rétablit sa valeur par défaut si vous lui affectez Nothing . Si vous fournissez un type de valeur dans Expression, IsNothing retourne Falsetoujours .

S’applique à

Voir aussi