difference between string.empty and isNullOrEmpty?
.net, vb.net
Solution
`String.Empty` is `""`, null is `Nothing`.
you can compare if a string is null, if it's empty, or both at the same time with `IsNullOrEmpty ()`
Problem
I have the following short piece of code that is never returning the string "selected". ``` Protected Function SelectedType(ByVal val As String) As String If val <> String.Empty Then Return "selected" End Function ``` However, if I change it to this, it works. Is there anything wrong when my shorthand code above? -Thanks ``` Protected Function SelectedType(ByVal val As String) As String If Not String.IsNullOrEmpty(val) Then Return "selected" End If End Function ```