Skip to content

Instantly share code, notes, and snippets.

@tecmaverick
Created August 4, 2012 06:46
Show Gist options
  • Save tecmaverick/3255206 to your computer and use it in GitHub Desktop.
Save tecmaverick/3255206 to your computer and use it in GitHub Desktop.
LINQ Test
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Xml.Linq;
namespace LINQTest
{
class Program
{
static void Main(string[] args)
{
XElement loadedData = XElement.Parse(
@"<Root><UserLogin>
<username>TEST</username>
<status>TRUE</status>
<username>qwe</username>
<status>FALSE</status>
</UserLogin></Root>");
var status = from query in loadedData.Descendants("UserLogin")
where query.Element("username").Value == "TEST"
select (string)query.Element("status");
foreach (var item in status)
{
Console.WriteLine(item);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment