There is no shortcut for creating get
/set
property in F#, but if you want a property with just get
you can use the following simple syntax:
type Test(n) =
let myValue = n * 2
member x.Property =
// Evaluated each time you access property value
myValue + 5
Since F# is a functional language, F# types are very often immutable. This syntax makes it very easy to define immutable types, so it also encourages you to use a good functional programming style in F#.
However, I agree that a shortcut for get
/set
property would be very useful, especially when writing some code that needs to interoperate with C# / other .NET libraries.
EDIT (5 years later...): This has been added in F# 3.0, as the answer from Ben shows :-)