Excel-DNA: F# Error Initialization [Error] Method not registered

℡╲_俬逩灬. 提交于 2019-12-11 01:48:51

问题


As a neophyte F# developer, I am trying to create a simple Excel-DNA function as follows:

[<ExcelFunction(Name="ACount", Description="Count items", Category="Misc Functions", IsThreadSafe = true)>]
let aCount (range: _[]) (filter: string) = 
    let result = 
        Seq.ofArray range
        |> Seq.filter (fun x -> x = filter)
        |> Seq.length
    result

but it generates the following error on loading to Excel 2016 (64-bit):

Initialization [Error] Method not registered - unsupported signature, abstract or generic:

What am I doing wrong?


回答1:


Thanks Govert.

The following works but is it sufficiently idiomatic?

[<ExcelFunction(Name="ACount", Description="Count items", Category="Misc Functions", IsThreadSafe = true)>]
let aCount (range: obj[]) (filter: string) = 
    let result = 
        Seq.ofArray range
        |> Seq.filter (fun x -> string x = filter)
        |> Seq.length
    result

Any constructive changes welcome!



来源:https://stackoverflow.com/questions/46407760/excel-dna-f-error-initialization-error-method-not-registered

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!