FirstOrDefault In F#

前端 未结 4 1072
孤街浪徒
孤街浪徒 2021-01-17 12:27

How to write FirstOrDefault Linq Query in F#? Can I use linq to sql in F# in totally?

4条回答
  •  执念已碎
    2021-01-17 13:02

    Regarding LINQ-to-SQL, see

    http://blogs.msdn.com/dsyme/archive/2009/10/23/a-quick-refresh-on-query-support-in-the-f-power-pack.aspx

    Regarding FirstOrDefault, it's just an extension method in the System.Linq namespace:

    let l = [1;2;3]
    open System.Linq 
    let r = l.FirstOrDefault()
    

提交回复
热议问题