I'm trying to get this sitemap class working.
It appears to use LINQ, which I've never used, but half the fun of programming is learning new stuff!
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, "Dim folders = From o In Directory.GetDirectories...", it's telling me "End of statement expected."
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?
Here's the 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
Thanks y'all. Stack Overflow rocks.