have the following in my project, written in VB.NET:
Dim items = From item In rssFeed.Elements("forecast").Elements("tabular").Elements("time") _
Select New WetherItem With {.time=item.Element("windDirection").Attribute("code").Value }
How is this written in C #?
I have tried the following ...
XElement rssFeed = XElement.Load(@"http://www.yr.no/sted/Norge/Rogaland/Karm%C3%B8y/Torvastad/varsel.xml");
var items = from item in rssFeed.Elements("forecast").Elements("tabular").Elements("time")
select new WetherItem { .time=item.Element("windDirection").Attribute("code").Value };
But I get the error message from
rssFeed.Elements("forecast").Elements("tabular").Elements("time")
Error 5 Could not find an implementation of the query pattern for source type 'System.Collections.Generic.IEnumerable'. 'Select' not found. Are you missing a reference or a using directive for 'System.Linq'? c:\users\\documents\visual studio 2012\Projects\Database1\Database1\SqlStoredProcedure1.cs 32 30 Database1
I have reference to System.XML.Linq and System.Data.Linq
From item In rssFeed.<forecast>.<tabular>.<time> Select New WetherItem With {.time = item.<windDirection>.@code}.