- In the Query menu, choose Query Properties.
- In the Additional References tab, choose Add, and type Microsoft.VisualBasic.
- Then in the Additional Namespace Imports tab, choose the Pick from assemblies link. Choose the Microsoft.VisualBasic.dll assembly, select the Microsoft.VisualBasic namespace, and then click Add Selected Namespace.
Showing posts with label LINQPad. Show all posts
Showing posts with label LINQPad. Show all posts
Thursday, May 4, 2017
Use Visual Basic functions in a LINQPad query
Occasionally, you want to include a Visual Basic (or C#) function such as IIF or Chr() in a LINQ query using LINQPad. There is two steps to this:
Tuesday, July 21, 2015
Query XML files with LINQ
If you regularly work with XML, knowing a technique to directly query it can be a real asset. I have found LINQ to XML together with LINQPad to be really helpful. The best thing to do is to simply show an example. Here we have a trivial XML file that we load in and display:
Then, let's say we want to list all plants from the file:
The tricky part is that if there are namespaces in your xml (and there usually is), then you need to include the namepace in braces.
Then, let's say we want to list all plants from the file:
The tricky part is that if there are namespaces in your xml (and there usually is), then you need to include the namepace in braces.
Subscribe to:
Posts (Atom)