问题
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