Debugger によると、myCancelled
Nothing の値を持つ型 Newtonsoft.Json.Linq.Jtoken と呼ばれる変数があります。また、それを Object にキャストしましたが、これらの条件はすべて失敗します。私の質問は単純です:それがNothing/Null/False/Emptyかどうかを確認するにはどうすればよいですか?
これが私が試したことです。これらの条件はいずれも true と評価されません。
If myCancelled Is Nothing Then
'Doesn't come here
End If
If myCancelled = DBNull.Value.ToString Then
'Doesn't come here
End If
If myCancelled = "null" Then
'Doesn't come here
End If
If IsDBNull(myCancelled) Then
'Doesn't come here
End If
If myCancelled Is DBNull.Value Then
'Doesn't come here
End If
If String.IsNullOrEmpty(myCancelled) = True Then
'Doesn't come here
End If
If myCancelled.ToString = "Nothing" Then
'Runtime error
End If
If myCancelled = DBNull.Value Then
'Runtime error
End If
If IsNothing(myCancelled) Then
'Doesn't come here
End If
私はVB.netを初めて使用するので、ポインタをいただければ幸いです。
編集
これは機能しましたが、誤検知を通過させます(myCancelledに値がある場合、条件は真です)
If Not myCancelled Then
' It comes here
End If