O'Reilly logo

Mastering F# by Suhaib Fahad, Alfonso García-Caro Núñez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Query builder

The query builder allows use to write LINQ-like queries within query { ... } code blocks. The F# LINQ expressions have all the functions defined in the QueryBuilder class. We can also define our own query builder and use the CustomOperation attribute to define new LINQ operations. The need to build a custom query builder is required when we have a new set of functions that is not available in the existing QueryBuilder class, or if we want to have custom functions for data collections.

In this section, we will learn how to create a custom sequence builder to reuse the Seq module as LINQ query expressions. The query expression needs to satisfy three preconditions, which are as follows:

  • For: This is the method used to support the F# query ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required