我经常调用静态方法来调用静态类,这对我来说似乎很不自然:
let l = Seq.length myseq
对我来说使用会更自然
let l = myseq.length
你可以想象很多基类都是一样的
有没有办法让所有这些方法作为实例方法自动可用,而无需为每个方法编写扩展方法?
最佳答案
Is there a way to have all those methods available automatically as instance method, without writing extension methods for each of them ?
不,即使你这样做了,你也会失去 F# 中类型推断的好处。
关于f# - 普通类上 fsharp 中的静态函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9500691/