我有很多实现接口的类。每当我定义一个类时,我必须在类定义中编写类似的东西:
interface Model.IModel with
member this.Assets = modelArg.Assets
member this.AuxData = modelArg.AuxData
member this.Benchmark = modelArg.Benchmark
member this.CalcPeriods = modelArg.CalcPeriods
member this.CashTicker = modelArg.CashTicker
member this.Description = modelArg.Description
member this.FirstValidDate = modelArg.FirstValidDate
member this.Name = modelArg.Name
member this.ParamData = modelArg.ParamData
member this.ParamList = modelArg.ParamList
member this.Strategy = modelArg.Strategy
member this.CalcStartTime with get() = calcStartTime and
set v = calcStartTime <- v
member this.Counter with get() = counter and
set v = counter <- v
有没有办法避免为从IModel接口派生的每个类重复这个?代码在所有情况下都是相同的。