Monday, August 15, 2011

Write small Program to generate Xml Document from table like (StudentRecord Table) using linq query


Public void CreateXmlDocFromArray()

{

// Now enumerate over the array to build an XElement.
XElement StudentRecords =
new XElement("StudentInfo",
from c in Student
select new XElement("Student",
new XAttribute("Name", c.Name),
new XElement("RollNo", c.RollNo)
)
);
Console.WriteLine(StudentRecords);
}

No comments:

Post a Comment