tryCreate
Function Signature
string -> 'a -> Result<^b, (string * 'c)>^b : (static member TryCreate : 'a -> Result< ^b, 'c>)Examples
Example 1
type Longitude = private Longitude of float with
member this.Value = let (Longitude lng) = this in lng
// float -> Result<Longitude, string>
static member TryCreate (lng : float) =
if lng >= -180. && lng <= 180. then
Ok (Longitude lng)
else
Error $"%A{lng} is a invalid longitude value"Example 2
Example 3
Last updated