Created
August 4, 2012 06:46
-
-
Save tecmaverick/3255206 to your computer and use it in GitHub Desktop.
LINQ Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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