Using LINQPad to test your LINQ queries
Posted by Jonathon Twigg on 31 August 2011 04:37 PM

LINQpad is a good tool for getting the hang of LINQ, it can also do LINQ to SQL.

To run a query against the xml you need to set the language to "C# Statement"

// Set where the xml is located
var XmlFileLocation = @"G:\www\Local\Verve_TestSite\wwwroot\verve\_data\content.xml";

// Load the xml file
XElement xmlDocument = XElement.Load(XmlFileLocation);

// Perform some query
var asset = xmlDocument.Descendants("asset").Where(c => c.Attribute("id") != null && c.Attribute("id").Value.Equals("803")).FirstOrDefault();

// Write out the results

 linqpad_sample.png (66.39 KB)
 vere data query.linq (0.45 KB)
(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Help Desk Software by Kayako Fusion