In F#, what is the correct syntax to specify a DefaultValue on the DataContract? For example, in the code below, how do I set the default value for address to "".
[<DataContract>]
type Geocode =
{ [<field: DataMember(Name = "type")>]
typeX : string
[<field: DataMember(Name = "address")>]
address : string }
Records don't support default values for fields. You'll have to use a class and the [<DefaultValue>]
attribute. You can read more in the MSDN article on Explicit Fields.