Skip to content

Commit 7c1bf15

Browse files
Add text per issue 26569. (#37850)
1 parent 04d983c commit 7c1bf15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/visual-basic/language-reference/nothing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ If a variable is of a reference type, assigning `Nothing` to the variable sets i
3333

3434
[!code-vb[VbVbalrKeywords#8](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrKeywords/VB/class3.vb#8)]
3535

36-
When checking whether a reference (or nullable value type) variable is `null`, do not use `= Nothing` or `<> Nothing`. Always use `Is Nothing` or `IsNot Nothing`.
36+
To check whether a reference (or nullable value type) variable is `null`, always use `Is Nothing` or `IsNot Nothing`. Don't use `= Nothing` or `<> Nothing`.
3737

38-
For strings in Visual Basic, the empty string equals `Nothing`. Therefore, `"" = Nothing` is true.
38+
For strings in Visual Basic, the empty string equals `Nothing`. Therefore, `"" = Nothing` is true. This fact makes it especially important that you choose the correct comparison when you work with strings. Although `myString = Nothing` and `myString <> Nothing` indicate whether a non-empty value is set, we strongly recommend using `String.IsNullOrEmpty(myString)` for this purpose. Use `Is Nothing` and `IsNot Nothing` to determine whether any value, including an empty string, was set.
3939

4040
The following example shows comparisons that use the `Is` and `IsNot` operators:
4141

0 commit comments

Comments
 (0)