Information.IsNothing(Object) メソッド

定義

式にオブジェクトが割り当てられていないかどうかを示す Boolean 値を返します。

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

パラメーター

Expression
Object

必須。 Object 式。

返品

式にオブジェクトが割り当てられていないかどうかを示す Boolean 値を返します。

次の例では、 IsNothing 関数を使用して、オブジェクト変数がオブジェクト インスタンスに関連付けられているかどうかを判断します。

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)

注釈

IsNothing は、現在オブジェクトが割り当てられていないオブジェクト変数を式が表す場合は True を返します。それ以外の場合は、 Falseを返します。

IsNothing は、参照型で動作することを目的としています。 値型は Nothing の値を保持できず、 Nothing を割り当てると既定値に戻ります。 Expressionで値型を指定した場合、IsNothingは常にFalseを返します。

適用対象

こちらもご覧ください