我在F#中具有以下类,该类继承了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> =
            ...

09-16 20:49