Table of contents
Collapse the table of content
Expand the table of content

Core.Option<'T> Union (F#)

Den Delimarsky|Last Updated: 8/18/2017
1 Contributor

Specifies the type of optional values, which you use when there might or might not be a value.

Namespace/Module Path: Microsoft.FSharp.Core

Assembly: FSharp.Core (in FSharp.Core.dll)


type Option<'T> =
| None
| Some of 'T
interface IStructuralEquatable
interface IComparable
interface IComparable
interface IStructuralComparable
static member Some : 'T -> 'T option
member this.IsNone :  bool
member this.IsSome :  bool
static member None :  'T option
member this.Value :  'T


Use the constructors Some and Noneto 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 appear as the value null to other .NET Framework languages. Instance methods of this type appear as static methods to other .NET Framework languages because of the use of null as a value representation.

For an overview of options, see Options (F#).

This type is named FSharpOption in compiled assemblies. If you are accessing the type from a language other than F#, or through reflection, use this name.

Instance Members

IsNoneReturns true if the option is a None value.
IsSomeReturns true if the option is a Some value.
ValueGets the value of a Some option. A NullReferenceException is raised if the option is None.

Static Members

NoneCreates an option value that is a None value.
SomeCreates an option value that is a Some value.

Union Cases

NoneSpecifies that there is no value.
Some of 'TContains the value, when there is a value.


Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Microsoft.FSharp.Core Namespace (F#)

© 2020 Microsoft