c**t 发帖数: 2744 | 1 using System;
using System.Query;
using System.Xml.XLinq;
using System.IO
namespace LinqToXmlSample.FlatFileToXml
{
class Program
{
static void main(string [] args)
{
XElement xml =
new XElement("books",
from line in File.ReadAllLines("books.txt")
where !line.StartsWith("#")
let items = line.Split(',')
select new XElement("book",
new XElement("title", items[1]),
new XElement("authors",
from authorFullName in items[2].Split(';')
let authorNameParts = |
|