Solution : The type or namespace name 'XElement' could not be found (are you missing a using directive or an assembly reference?)
Error Code
using System;
using System.Collections.Generic;
using System.Linq;
XElement Inv = new XElement("Invoice",
from items in FileContent
let fields = items.Split(',')
select new XElement("Item",
new XElement("ID", fields[0]),
new XElement("Name", fields[1]),
new XElement("Price", fields[2]),
new XElement("Availability", fields[3])
Solution
Inclusion of using System.Xml.Linq directive will solve the problem
System.Xml.Linq, C# Error codes, .Net Error codes, 'XElement' in C#, 'XElement' in .NET
![Digg Digg](http://benny.ayong.googlepages.com/digg.png)
![Technorati Technorati](http://benny.ayong.googlepages.com/technorati.png)
![Del.icio.us Delicious](http://benny.ayong.googlepages.com/delicious.png)
![Stumble Upon StumbleUpon](http://benny.ayong.googlepages.com/stumbleupon.png)
![reddit Reddit](http://benny.ayong.googlepages.com/reddit.png)
![BlinkList BlinkList](http://benny.ayong.googlepages.com/blinklist.png)
![Furl Furl](http://benny.ayong.googlepages.com/furl.png)
![Mixx Mixx](http://benny.ayong.googlepages.com/mixx.png)
![facebook Facebook](http://benny.ayong.googlepages.com/facebook.png)
![Google Bookmark](http://benny.ayong.googlepages.com/googlebookmark.png)
![Yahoo Myweb Yahoo](http://benny.ayong.googlepages.com/yahoomyweb.png)
![ma.gnolia](http://benny.ayong.googlepages.com/magnolia.png)
![squidoo](http://benny.ayong.googlepages.com/squidoo.png)
![newsvine](http://benny.ayong.googlepages.com/newsvine.png)
![live](http://benny.ayong.googlepages.com/live.png)
![netscape](http://benny.ayong.googlepages.com/netscape.gif)
![tailrank](http://benny.ayong.googlepages.com/tailrank.png)
![mister-wong](http://benny.ayong.googlepages.com/misterwong.gif)
![blogmarks](http://benny.ayong.googlepages.com/blogmarks.png)
![slashdot](http://benny.ayong.googlepages.com/slashdot.png)
![spurl](http://benny.ayong.googlepages.com/spurl.png)
![StumbleUpon](http://www.stumbleupon.com/images/stumble7.gif)
using System.Xml.Linq;
ReplyDeleteor you could use it like this.
using System.Xml.Linq.XElement
I think the first one is better.