This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Contact() = | |
let mutable firstName = "" | |
let mutable lastName = "" | |
let mutable phone = "" | |
member x.FirstName with get() = firstName and set v = firstName <- v | |
member x.LastName with get() = lastName and set v = lastName <- v | |
member x.Phone with get() = phone and set v = phone <- v |
First, we'll change the model to be an F# record. The new model looks like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Contact = { FirstName : string; LastName : string; Phone : string } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let contacts = seq { yield { FirstName = "John"; LastName = "Doe"; Phone = "123-123-1233" } | |
yield { FirstName = "Jane"; LastName = "Doe"; Phone = "123-111-9876" } } |
No comments:
Post a Comment