Skip to content

M_CommandLine_ParserResultExtensions_MapResult__3

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

ParserResultExtensions.MapResult(T1, T2, TResult) Method (ParserResult(Object), Func(T1, TResult), Func(T2, TResult), Func(IEnumerable(Error), TResult))

Provides a way to transform result data into another value.

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

Syntax

C#

public static TResult MapResult<T1, T2, TResult>(
	this ParserResult<Object> result,
	Func<T1, TResult> parsedFunc1,
	Func<T2, TResult> parsedFunc2,
	Func<IEnumerable<Error>, TResult> notParsedFunc
)

VB

<ExtensionAttribute>
Public Shared Function MapResult(Of T1, T2, TResult) ( 
	result As ParserResult(Of Object),
	parsedFunc1 As Func(Of T1, TResult),
	parsedFunc2 As Func(Of T2, TResult),
	notParsedFunc As Func(Of IEnumerable(Of Error), TResult)
) As TResult

C++

public:
[ExtensionAttribute]
generic<typename T1, typename T2, typename TResult>
static TResult MapResult(
	ParserResult<Object^>^ result, 
	Func<T1, TResult>^ parsedFunc1, 
	Func<T2, TResult>^ parsedFunc2, 
	Func<IEnumerable<Error^>^, TResult>^ notParsedFunc
)

F#

[<ExtensionAttribute>]
static member MapResult : 
        result : ParserResult<Object> * 
        parsedFunc1 : Func<'T1, 'TResult> * 
        parsedFunc2 : Func<'T2, 'TResult> * 
        notParsedFunc : Func<IEnumerable<Error>, 'TResult> -> 'TResult 

Parameters

 

result
Type: CommandLine.ParserResult(Object)
The result in verb scenario.
parsedFunc1
Type: System.Func(T1, TResult)
Lambda executed on successful parsing of T1.
parsedFunc2
Type: System.Func(T2, TResult)
Lambda executed on successful parsing of T2.
notParsedFunc
Type: System.Func(IEnumerable(Error), TResult)
Lambda executed on failed parsing.

Type Parameters

 

T1
First verb type.
T2
Second verb type.
TResult

Return Value

Type: TResult
The new value.

Usage Note

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

ParserResultExtensions Class
MapResult Overload
CommandLine Namespace

Clone this wiki locally