title: Implementing Try, Catch on Syndication Feed (RSS) Type
body: <p>I want to create a try catch so that if the feed does not exist or cannot be created for some reason, it will return false or null so that I can then test the variable and create a default item.</p>
  
  <pre><code>Function GetFeed(url As String) As SyndicationFeed
  
      Dim feed = New SyndicationFeed
  
      Try
          Dim reader = XmlReader.Create(url)
          feed = SyndicationFeed.Load(reader)
      Catch ex As Exception
          feed = Nothing
      End Try
  
      Return feed
  
  End Function
  </code></pre>
  
  <p>It says I can't set type "SyndicationFeed" to boolean.</p>
  
  <p>The error is with this code:</p>
  
  <pre><code>    Dim feedUrl = "http://rss.news.yahoo.com/rss/entertainment"
      Dim feed As SyndicationFeed = GetFeed(feedUrl)
  
      If feed = Nothing Then
  
      End If
  </code></pre>
  
  <p>It says, "operator '=' is not defined for type SyndicationFeed."</p>