简体   繁体   中英

I got this msg while using F# query expression : error FS0039: Undefined value or constructor “query”

let q = <@  seq {
                for i in [1..10] do
                    yield i  
        } |> Seq.head @>

q |> query |> ignore  //error FS0039

I'am using VS2012 and F# core of "ReferenceAssemblies\\Microsoft\\FSharp\\3.0\\Runtime\\v2.0\\FSharp.Core.dll" (version 2.3.0.0) on .NET 3.5 ;

What did I miss here?

I might be wrong (the versioning is a bit confusing) but if you're using F# 3.0 in Visual Studio 2012, then you should be able to use the new query expression syntax instead:

query { for i in 1 .. 10 do
        select i
        head }

This works both in memory and for SQL databases (as well as some type providers). For more information, see the MSDN documentation . If you're using older version (or target framework), then I'd definitely recommend upgrading - the F# 3.0 queries are much more solid and easy to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM