I'm new in this domain and i really need some help plz !!! What i need is to take all the filenames of images, placed in a specific folder, and place them (filename) in a XML document. someone has an example ?? or a clue ??
thx a lot to everyone !!!
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Subhendu DePosted Dec 8, 2010, 1:20 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Linq;
namespace TestXML
{
class Program
{
static void Main(string[] args)
{
string _filepath = @"
DirectoryInfo _dirinfo = new DirectoryInfo(_filepath);
FileInfo[] _files = _dirinfo.GetFiles();
XElement _xml = new XElement("Images",
from _file in _files
select new XElement("Image", _file.Name));
Console.WriteLine(_xml);
}
}
}
Output is
======
Press any key to continue . . .
Thanks.....