0

これに対する明確な答えは見つかりませんでした...

この C# コードに相当する F# は何ですか?

public class SomeClass
{
    public virtual SomeMethod([Attribute] Int32 param)
    { }
}

F# には、属性を配置する場所が 2 つあります。

type SomeClass () =

   abstract SomeMethod : [<Attribute>] param:Int32 -> Unit
   default this.SomeMethod ([<Attribute>] param) = ()
4

1 に答える 1

3

両方に配置できますが、重要なのはオーバーライド ( default) です。

type T =
  abstract M : (* [<Out>] this is okay too *) i: byref<int> -> unit
  default this.M([<Out>] i) = () //but this one's necessary
于 2013-09-11T19:55:03.680 に答える