Skip to content

M_CSharpx_MaybeExtensions_MapValueOrDefault__2

Moh.Hassan edited this page Oct 10, 2019 · 1 revision

MaybeExtensions.MapValueOrDefault(T1, T2) Method

If contains a values executes a mapping function over it, otherwise returns noneValue.

Namespace: CSharpx
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

public static T2 MapValueOrDefault<T1, T2>(
	this Maybe<T1> maybe,
	Func<T1, T2> func,
	T2 noneValue
)

VB

<ExtensionAttribute>
Public Shared Function MapValueOrDefault(Of T1, T2) ( 
	maybe As Maybe(Of T1),
	func As Func(Of T1, T2),
	noneValue As T2
) As T2

C++

public:
[ExtensionAttribute]
generic<typename T1, typename T2>
static T2 MapValueOrDefault(
	Maybe<T1>^ maybe, 
	Func<T1, T2>^ func, 
	T2 noneValue
)

F#

[<ExtensionAttribute>]
static member MapValueOrDefault : 
        maybe : Maybe<'T1> * 
        func : Func<'T1, 'T2> * 
        noneValue : 'T2 -> 'T2 

Parameters

 

maybe
Type: CSharpx.Maybe(T1)
func
Type: System.Func(T1, T2)
noneValue
Type: T2

Type Parameters

 

T1
T2

Return Value

Type: T2

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Maybe(T1). 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).

See Also

Reference

MaybeExtensions Class
CSharpx Namespace

Clone this wiki locally