F#继承接口
F# inherit interface
我在 F# 中有以下 class 继承 Microsoft.AspNet.Identity.IIdentityValidator 接口:
type MyValidation() =
inherit IIdentityValidator<string> with
member x.ValidateAsync (value:string) : Task<IdentityResult> =
.....
我收到这个错误:
This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e.g. 'inherit BaseType(args)'.
为什么以及如何解决?
关键字 inherit
仅用于派生 类。您需要使用 interface
:
type MyValidation() =
interface IIdentityValidator<string> with
member x.ValidateAsync (value:string) : Task<IdentityResult> =
...
我在 F# 中有以下 class 继承 Microsoft.AspNet.Identity.IIdentityValidator 接口:
type MyValidation() =
inherit IIdentityValidator<string> with
member x.ValidateAsync (value:string) : Task<IdentityResult> =
.....
我收到这个错误:
This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e.g. 'inherit BaseType(args)'.
为什么以及如何解决?
关键字 inherit
仅用于派生 类。您需要使用 interface
:
type MyValidation() =
interface IIdentityValidator<string> with
member x.ValidateAsync (value:string) : Task<IdentityResult> =
...