[Home] Type Microsoft.FSharp.Core.Option


The type of optional values. When used from other .NET languages the empty option is the 'null' value. Use the constructors [[Some]] and [[None]] to create values of this type. Use the values in the [[Option]] module to manipulate values of this type, or pattern match against the values directly. 'None' values will appear as the value 'null' to other .NET languages. Instance methods on this type will appear as static methods to other .NET languages due to the use of 'null' as a value representation.

Full Type Signature

[<DefaultAugmentationAttribute (false); CompilationRepresentationAttribute (enum<CompilationRepresentationFlags> (8))>]
type Option<'a> =
  | None
  | Some of 'a
  with
    static member Some : 'a -> 'a option
    member IsNone : bool
    member IsSome : bool
    [<CompilationRepresentationAttribute (enum<CompilationRepresentationFlags> (2));
      Obsolete ("This member has been renamed to .Value")>]
    member Item : 'a
    static member None : 'a option
    [<CompilationRepresentationAttribute (enum<CompilationRepresentationFlags> (2))>]
    member Value : 'a
  end

Instance Members

MemberDescription
member IsNone : bool
Return 'true' if the option is a 'None' value.
member IsSome : bool
Return 'true' if the option is a 'Some' value.
[<CompilationRepresentationAttribute (enum<CompilationRepresentationFlags> (2))>]
member Value : 'a
Get the value of a 'Some' option. A NullReferenceException is raised if the option is 'None'.

Static Members

MemberDescription
member None : 'a option
Create an option value that is a 'None' value.
member Some : 'a -> 'a option
Create an option value that is a 'Some' value.

Deprecated Members

MemberDescription
[<CompilationRepresentationAttribute (enum<CompilationRepresentationFlags> (2));
  Obsolete ("This member has been renamed to .Value")>]
member Item : 'a

Note: This member has been renamed to .Value

See Also

Microsoft.FSharp.Core


Documentation for assembly FSharp.Core, version 1.9.4.19, generated using F# version 1.9.4.19