DirectoryInfo di = new DirectoryInfo(@"d:\");
var dirQuery = from dir in di.GetDirectories()
orderby di.Name
select new { fName = dir.Name};
foreach(var folderName in dirQuery)
{
ListBox1.Items.Add(folderName.fName);
}
Wednesday, August 27, 2008
Tuesday, August 26, 2008
LINQ to XML
LINQ --- Language Integrated Query
LINQ to Objects (to APIs)
LINQ to XML
LINQ to SQL (Relational database)
New namespace System.Xml.Linq includes a series of new LINQ to XML objects that make working with xml easier:
1) XDocument instead of XmlDocument
XDocument xdoc = XDocumnet.load(@"d:\HPCTO");
query xml:
XDocument xdoc = XDocument.Load(@"D:\HPCTO\Pavilio.xml");
var query = from ConfigGroup in xdoc.Descendants("ConfigGroup")
select new
{
ProductDescription = ConfigGroup.Attribute("Description").Value
};
foreach (var item in query)
{
Response.Write(item);
Response.Write("
");
LINQ to Objects (to APIs)
LINQ to XML
LINQ to SQL (Relational database)
New namespace System.Xml.Linq includes a series of new LINQ to XML objects that make working with xml easier:
1) XDocument instead of XmlDocument
XDocument xdoc = XDocumnet.load(@"d:\HPCTO");
query xml:
XDocument xdoc = XDocument.Load(@"D:\HPCTO\Pavilio.xml");
var query = from ConfigGroup in xdoc.Descendants("ConfigGroup")
select new
{
ProductDescription = ConfigGroup.Attribute("Description").Value
};
foreach (var item in query)
{
Response.Write(item);
Response.Write("
");
Subscribe to:
Posts (Atom)