小编Jay*_*ayR的帖子

在已注释类型的不确定类型的对象上查找错误

为什么我会收到"根据此程序点之前的信息查找不确定类型的对象......"的错误.

我已经注释了类型信息.

它突出了代码r.Read().

let rec foldResult myFunc accumulator r:SqlDataReader =
    if r.Read() then
        foldResult myFunc (myFunc 123456 accumulator) r:SqlDataReader
    else
        accumulator
Run Code Online (Sandbox Code Playgroud)

f#

9
推荐指数
1
解决办法
1285
查看次数

我的匹配似乎很笨重,有没有更好的方法来编码?

这似乎有效,但看起来很笨重.有没有更好的方法来编码?

// Hunting for the best index to use for a data compare
let getIndex connDB strTable =
    match getIndexByPrimaryKey connDB strTable with
    | Some(name) -> Some(name)  
    | None ->
    match getIndexByCluster connDB strTable with
    | Some(name) -> Some(name)
    | None -> 
    match getIndexByFirstColumns connDB strTable with
    | Some(name) -> Some(name)
    | None -> 
    match getIndexByOnlyUnique connDB strTable with
    | Some(name) -> Some(name)
    | None -> 
    match getAnyUniqueIndex connDB strTable with
    | Some(name) -> Some(name)
    | None -> None
Run Code Online (Sandbox Code Playgroud)

f# pattern-matching option

3
推荐指数
1
解决办法
220
查看次数

标签 统计

f# ×2

option ×1

pattern-matching ×1