Is there a difference between using a read-only property:
type T(arg) =
member x.M = arg
and using an automatically implemented property:
type T(arg) =
member val M = arg
assuming arg has no side effects? Any reason to prefer one over the other?
The essential difference between those is that
member valrepresents an expression that is computed only once during instance initialization. Therefore,So, the first consideration is performance.
Another consideration is based on two limitations of auto properties:
virtual