【发布时间】:2011-01-18 22:13:03
【问题描述】:
对于这个类的定义:
type Foo(f1: int, f2: string) =
member x.F1 = f1
member x.F2 = PostProcess f2
每次访问 f2 时都会调用 PostProcess(一些字符串操作函数)吗?如果答案是肯定的并且我想避免它,那么正确的成语是什么?下面这个推荐吗?这对我来说有点太冗长了。
type Foo =
val F1: int
val F2: string
new (f1, f2) as this =
{F1 = f1; F2 = f2;}
then this.F2 = PostProcess(f2) |> ignore
【问题讨论】:
-
相关的问题,任何登陆这里的人都可能感兴趣:stackoverflow.com/questions/1624571/…