2
F#で明示的なフィールドが必要な場合は誰でも助けてくれますか?例えば、どのように次の三つのクラスがF#クラスのプロパティと明示的なフィールド
type MyClass(a0:int,b0:int) =
member x.a = a0
member x.b = b0
と比較
または
type MyClass() =
[<DefaultValue>] val mutable a: int
[<DefaultValue>] val mutable b: int
member this.Setab(a0: int, b0: int) =
a<- a0
b<- b0
type MyClass =
val a : int
val b : int
new(a0, b0) = { a = a0; b = b0; }
全て有用であろう私は最後のクラスを理解することができます。ありがとう。
EDIT:、次の質問は、最初の2つの概念が必要であることの例である:Order of fields in a type for FileHelpers