Skip to content

Methods_T_CodeJam_Option

Andrew Koryavchenko edited this page Jul 4, 2017 · 4 revisions

Option Methods

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

Option Class
CodeJam Namespace

Clone this wiki locally