Excel-DNA:F#错误初始化[错误]方法未注册 [英] Excel-DNA: F# Error Initialization [Error] Method not registered
本文介绍了Excel-DNA:F#错误初始化[错误]方法未注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
作为新手F#开发人员,我试图创建一个简单的Excel-DNA函数,如下所示:
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
但是在加载到Excel 2016(64位)时会产生以下错误:
but it generates the following error on loading to Excel 2016 (64-bit):
初始化[错误]方法未注册- 不支持的签名(抽象或通用):
Initialization [Error] Method not registered - unsupported signature, abstract or generic:
我在做什么错了?
推荐答案
感谢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!
这篇关于Excel-DNA:F#错误初始化[错误]方法未注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文