title: How can I determine is stream is empty?
body: <p>I have a WCF service which is returning PDF files as a stream over a NetTcp endpoint. This is all working fine. However, if the file is not found, or if I can't find the related row in the database to retrieve the filepath then I return <code>Stream.Null</code> from the service.</p>
  
  <p>However I can't seem to find a way to compare the returning stream to check and see if it is empty or not.</p>
  
  <p>I have tried the following:</p>
  
  <pre><code>If myStream IsNot Stream.Null
      'Code to execute if stream isn't empty
  End If
  </code></pre>
  
  <p>and</p>
  
  <pre><code>If Not streamPDF.Equals(Stream.Null)
      'Code to execute if stream isn't empty
  End If
  </code></pre>
  
  <p>But neither of these work as the code just carries on into the <code>If</code> block.</p>
  
  <p>Any thoughts?</p>