-
Notifications
You must be signed in to change notification settings - Fork 36
M_CodeJam_Option_GetValueOrDefault__2
Andrew Koryavchenko edited this page Jun 17, 2018
·
5 revisions
Calls someSelector if option has value, and noneSelector otherwise.
Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0
C#
public static TResult GetValueOrDefault<T, TResult>(
this IOption<T> option,
Func<IOption<T>, TResult> someSelector,
Func<TResult> noneSelector
)
VB
<ExtensionAttribute>
Public Shared Function GetValueOrDefault(Of T, TResult) (
option As IOption(Of T),
someSelector As Func(Of IOption(Of T), TResult),
noneSelector As Func(Of TResult)
) As TResult
F#
[<ExtensionAttribute>]
static member GetValueOrDefault :
option : IOption<'T> *
someSelector : Func<IOption<'T>, 'TResult> *
noneSelector : Func<'TResult> -> 'TResult
- option
- Type: CodeJam.IOption(T)
Option instance to match. - someSelector
- Type: System.Func(IOption(T), TResult)
Function if value exists. - noneSelector
- Type: System.Func(TResult)
Function if no value.
- T
- Type of value
- TResult
- Type of result
Type: TResult
Result of matched function
In Visual Basic and C#, you can call this method as an instance method on any object of type IOption(T). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).