Skip to content

T_CodeJam_Option

Andrew Koryavchenko edited this page Jun 17, 2018 · 6 revisions

Option Class

Methods to work with Option

Inheritance Hierarchy

System.Object
  CodeJam.Option
Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static class Option

VB

<ExtensionAttribute>
Public NotInheritable Class Option

F#

[<AbstractClassAttribute>]
[<SealedAttribute>]
[<ExtensionAttribute>]
type Option =  class end

The Option type exposes the following members.

Methods

 

Name Description
Public methodStatic member Do(T) Calls someAction if option has value, and noneAction otherwise.
Public methodStatic member GetValueOrDefault(T)(IOption(T), T) Returns value of option, or defaultValue if option hasn't it.
Public methodStatic member GetValueOrDefault(T, TResult)(IOption(T), Func(IOption(T), TResult), Func(TResult)) Calls someSelector if option has value, and noneSelector otherwise.
Public methodStatic member None(T) Returns instance of Option without value.
Public methodStatic member Some(T) Creates instance of Option with specified value.
Public methodStatic member SomeHasValue(T)(Nullable(T)) Creates instance of Option with specified value, if value has value.
Public methodStatic member SomeHasValue(T)(T) Creates instance of Option with specified value, if value not null.
Public methodStatic member With(T, TResult)(Option(T), Func(T, TResult)) Converts option value to another option with selectFunc.
Public methodStatic member With(T, TResult)(Option(T), Func(T, TResult), Func(TResult)) Converts option value to another option with selectFunc.
Public methodStatic member With(T, TResult)(Option(T), Func(T, TResult), TResult) Converts option value to another option with selectFunc.
  Back to Top

See Also

Reference

CodeJam Namespace

Clone this wiki locally