title: What is the most concise way to handle this Is Nothing/Empty String check?
body: <p>What is the best way to checkt o see if the TelephoneNumber property has some string in it that does not Trim down to an empty string? I hate to use the Trim VB.NET function on Nothing just to give me an empty string whenever the TelephoneNumber is Nothing.</p>
  
  <pre><code>   Public Class TelephoneNumberType
  
          Public Property TelephoneNumber() As String
  
      End Class
  
    Public Class Form1
  
      Private _PhoneObj As BusinessObjects.TelephoneNumberType
  
       Public Sub MySub
  
  
          If _PhoneObj IsNot Nothing AndAlso _
             _PhoneObj.TelephoneNumber isNot Nothing AndAlso _
             _PhoneObj.TelephoneNumber.Trim &lt;&gt; String.Empty Then
             MessageBox.Show("I have a non blank phone!")
          End If
  
        End Sub
  
      End Class
  </code></pre>
  
  <p>Edit:</p>
  
  <p>Check out the accepted answer and then call it as follows</p>
  
  <pre><code>If _PhoneObj IsNot Nothing AndAlso _
     _PhoneObj.TelephoneNumber.IsNullOrEmpty Then
      MessageBox.Show("I have a non blank phone!")
  End If
  </code></pre>
  
  <p>What puzzles me is that the "IsNullOrEmpty" function works as an extension method of a string instance even if the String is NOTHING. Why does this extension method work but the follow straight - .NET code raise an exception?</p>
  
  <pre><code>Dim s as string
  
  
  If s.trim() = "" Then   
      Message.Box.Show("This will never print") 
  End If
  </code></pre>