2015-03-03 129 views
2

我在F#以下的类继承Microsoft.AspNet.Identity.IIdentityValidator接口:F#继承接口

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)'. 

为什么和如何解决它?

+0

我指出Microsoft.AspNet.Identity.IIdentityValidator不属于C#。 – phoog 2015-03-03 23:36:53

+0

它属于ASP.NET? – Marta 2015-03-04 08:22:41

+0

这将是描述它的更好方式。 – phoog 2015-03-04 18:26:05

回答

4

关键字inherit只适用于派生类。您需要使用interface

type MyValidation() = 
    interface IIdentityValidator<string> with 
     member x.ValidateAsync (value:string) : Task<IdentityResult> = 
      ...