title: VB.NET and LINQ. What am I missing here?
body: <p>I'm trying to get <a href="http://www.dotnetcurry.com/ShowArticle.aspx?ID=281&amp;AspxAutoDetectCookieSupport=1" rel="nofollow noreferrer">this sitemap clas</a>s working.</p>
  
  <p>It appears to use LINQ, which I've never used, but half the fun of programming is learning new stuff!</p>
  
  <p>My problem is that I'm getting compile errors where the LINQ code is.  VS just doesn't recognize it.  I've a reference to system.data.linq, I've an imports system.data.linq, but still where the code reads, <strong>"Dim folders = From o In Directory.GetDirectories..."</strong>, it's telling me "End of statement expected."</p>
  
  <p>What am I missing in wiring this thing up so that I can use LINQ?  My framework is 2.0.5.  Is LINQ simply unavailable to me in 2?  If so, why is system.data.linq in my GAC?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>    Private Sub AddFolders(ByVal parentNode As SiteMapNode)
  Dim folders = From o In Directory.GetDirectories(HttpContext.Current.Server.MapPath(parentNode.Key)) _
  Let dir = New DirectoryInfo(o) _
  Where Not Regex.Match(dir.Name, ExcludedFolders).Success _
  Select New ()
  
          For Each item In folders
              Dim folderUrl As String = parentNode.Key + item.DirectoryName
              Dim folderNode As New SiteMapNode(Me, folderUrl, Nothing, item.DirectoryName, item.DirectoryName)
  
              AddNode(folderNode, parentNode)
              AddFiles(folderNode)
          Next
      End Sub
  </code></pre>
  
  <p>Thanks y'all.  Stack Overflow rocks.</p>