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
using System.Xml.Linq;
ReplyDeleteor you could use it like this.
using System.Xml.Linq.XElement
I think the first one is better.