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:


  1. In the Query menu, choose Query Properties.
  2. In the Additional References tab, choose Add, and type Microsoft.VisualBasic.
  3. 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.