Skip to content

Options - F# missing convert to other types #40039

@naxels

Description

@naxels

Type of issue

Missing information

Description

Hi team,

Thank you for the details documentation on the Options in F#.

As a beginner, I did find some information missing that would be very valuable for converting Option to another type.
where other documentation would go straight into Pattern Matching Some/None,
F# also has a handy build-in function Option.defaultValue (as referenced here: https://stackoverflow.com/a/39436459)

A little expansion of the "Converting to Other Types" section of the documentation with for example:

String and Int

would already help with the following guided code:

optionString |> Option.defaultValue ""
optionInt |> Option.defaultValue 0

Thank you for consideration!

Page URL

https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/options

Content source URL

https://github.com/dotnet/docs/blob/main/docs/fsharp/language-reference/options.md

Document Version Independent Id

431e250a-3588-7741-dd43-8021d6c7ffa8

Article author

@KathleenDollard

Metadata

  • ID: ed1e23a2-091b-38be-3bbe-b3b38aa06aa5
  • Service: dotnet-fsharp

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnet-fsharp/svchelp wantedGood for community contributors to help [up-for-grabs]in-prThis issue will be closed (fixed) by an active pull request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions