Skip to content

T_CodeJam_Option_1

andrewvk edited this page Apr 5, 2016 · 9 revisions

Option(T) Structure

[This is preliminary documentation and is subject to change.]

Represents a value type that can be assigned null.

Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#

public struct Option<T>

VB

Public Structure Option(Of T)

F#

[<SealedAttribute>]
type Option<'T> =  struct end

Type Parameters

 

T
  The Option(T) type exposes the following members.

Constructors

 

Name Description
Public method Option(T) Initializes a new instance to the specified value.
  Back to Top

Properties

 

Name Description
Public property HasValue Gets a value indicating whether the current object has a value.
Public property Value Gets the value of the current object.
  Back to Top

Methods

 

Name Description
Public method Equals Indicates whether this instance and a specified object are equal. (Inherited from ValueType.)
Public method GetHashCode Returns the hash code for this instance. (Inherited from ValueType.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString Returns the fully qualified type name of this instance. (Inherited from ValueType.)
  Back to Top

Operators

 

Name Description
Public operatorStatic member Implicit(T to Option(T)) Creates a new object initialized to a specified value.
  Back to Top

Extension Methods

 

Name Description
Public Extension Method GetValueOrDefault(T) Returns value of option, or defaultValue if option hasn't it. (Defined by OptionExtensions.)
Public Extension Method Map(T, TResult) Converts option value to another option with selectFunc. (Defined by OptionExtensions.)
Public Extension Method Match(T)(Action(Option(T)), Action) Overloaded.
Calls someAction if option has value, and noneAction otherwise. (Defined by OptionExtensions.)
Public Extension Method Match(T, TResult)(Func(Option(T), TResult), Func(TResult)) Overloaded.
Calls someFunc if option has value, and noneFunc otherwise. (Defined by OptionExtensions.)
  Back to Top

See Also

Reference

CodeJam Namespace

Clone this wiki locally