Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
|
|
@ -9,6 +9,6 @@ s = String.Empty
|
|||
If s IsNot Nothing AndAlso s.Length = 0 Then
|
||||
End If
|
||||
|
||||
' Check for null or empty (most idiomatic .NET way):
|
||||
' Check for null or empty (more idiomatic in .NET):
|
||||
If String.IsNullOrEmpty(s) Then
|
||||
End If
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
Option Strict On
|
||||
|
||||
Module Program
|
||||
|
||||
Sub Main()
|
||||
' Equality is somewhat convoluted in .NET, and VB doesn't help by adding legacy means of comparison.
|
||||
' The means above are the author's recommendation for each case.
|
||||
' Some methods also return true if the string is Nothing/null; this is noted in the description for those that
|
||||
' The methods above are the author's recommendation for each case.
|
||||
' Some also return true if the string is Nothing/null; this is noted in the description for those that
|
||||
' do.
|
||||
|
||||
' s is initialized to Nothing. It is a variable of the System.String type that is a null reference and is not
|
||||
' the empty string.
|
||||
Dim s As String = Nothing
|
||||
|
||||
' Alias Console.WriteLine with a shorter name to make the demonstration code less verbose.
|
||||
Dim P = Sub(x As Boolean) Console.WriteLine(x)
|
||||
' Alias Console.WriteLine(Boolean) with a shorter name to make the demonstration code less verbose.
|
||||
Dim P As Action(Of Boolean) = AddressOf Console.WriteLine
|
||||
|
||||
' Assign the empty string literal to s.
|
||||
s = ""
|
||||
|
|
@ -111,7 +110,7 @@ Module Program
|
|||
|
||||
Console.WriteLine()
|
||||
|
||||
' Each of the means described above, except testing for a non-empty string.
|
||||
' Each of the methods described above, except testing for a non-empty string.
|
||||
P(s IsNot "")
|
||||
P(Not Object.ReferenceEquals(s, ""))
|
||||
P(s <> "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue