F# Positional Arguments in Attributes -


I am trying to create an attribute in F # with static arguments, but it has failed all the time.

  Type ColumnAttribute (? Index: int,? Name: string) = Get Attribute () Mute Index = Index to Temporary Name = Name Member x.Index to get () = Index and Set Value = Index & lt; - get value member x name () = name and set value = with name & lt; - Value Type Substance = {[And Ltf; Column (index = 1) & gt;] name: string [& lt; Column (index = 0) & gt;] ID: int [and lieutenant; Columns (name = "sequence") & gt;] sequence: string}   

I have tried many different ways but it is closest to me.

"post-text" itemprop = "text">

There are two codes that I see with your code

  1. To make this work you need to define any-argument constructor for ColumnAttribute .
  2. Index and names integer options and string options again ctively but you can Must be int and string .

    Try the following

      Type column attribute (index: int option, name: string option) = attribute () to get the mutual index = index temp Give name = name new () = column attribute (none, none) member X With index (get) = match index Something I - & gt; I None - & gt; 0 and set value = index & lt; - Some value members x Get () = Some names with match names -> En | None - & gt; "" And set the value = name - some value types substance = {[[[& lt; Columns (index = 1) & gt;]: string [& lt; Column (index = 0) & gt;] ID: integer [& lt; Columns (name = "sequence") & gt;] sequence: string}    

Comments