Please see following examples:
Visual BasicPublic Class Class1
Public Shared Function WithEmpty1(text As String) As Integer
If Not String.IsNullOrEmpty(text) Then
'CRR0027
Return text.Length
End If
Return 0
End Function
Public Shared Function WithEmpty2(text As String) As Integer
If String.IsNullOrEmpty(text) Then Return 0
'No CRR0027
Return text.Length
End Function
Public Shared Function WithWhiteSpace1(text As String) As Integer
If Not String.IsNullOrWhiteSpace(text) Then
'CRR0027
Return text.Length
End If
Return 0
End Function
Public Shared Function WithWhiteSpace2(text As String) As Integer
If String.IsNullOrWhiteSpace(text) Then Return 0
'CRR0027
Return text.Length
End Function
End Class
Robert,
Thank you for the report. I agree with you that IsNullOrEmpty and IsNullOrWhiteSpace can be taken into account when evaluating possible null reference diagnostics.