Skip to content

M_CommandLine_ParserResultExtensions_MapResult__7

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

ParserResultExtensions.MapResult(T1, T2, T3, T4, T5, T6, TResult) Method (ParserResult(Object), Func(T1, TResult), Func(T2, TResult), Func(T3, TResult), Func(T4, TResult), Func(T5, TResult), Func(T6, 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, T3, T4, T5, T6, TResult>(
	this ParserResult<Object> result,
	Func<T1, TResult> parsedFunc1,
	Func<T2, TResult> parsedFunc2,
	Func<T3, TResult> parsedFunc3,
	Func<T4, TResult> parsedFunc4,
	Func<T5, TResult> parsedFunc5,
	Func<T6, TResult> parsedFunc6,
	Func<IEnumerable<Error>, TResult> notParsedFunc
)

VB

<ExtensionAttribute>
Public Shared Function MapResult(Of T1, T2, T3, T4, T5, T6, TResult) ( 
	result As ParserResult(Of Object),
	parsedFunc1 As Func(Of T1, TResult),
	parsedFunc2 As Func(Of T2, TResult),
	parsedFunc3 As Func(Of T3, TResult),
	parsedFunc4 As Func(Of T4, TResult),
	parsedFunc5 As Func(Of T5, TResult),
	parsedFunc6 As Func(Of T6, TResult),
	notParsedFunc As Func(Of IEnumerable(Of Error), TResult)
) As TResult

C++

public:
[ExtensionAttribute]
generic<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename TResult>
static TResult MapResult(
	ParserResult<Object^>^ result, 
	Func<T1, TResult>^ parsedFunc1, 
	Func<T2, TResult>^ parsedFunc2, 
	Func<T3, TResult>^ parsedFunc3, 
	Func<T4, TResult>^ parsedFunc4, 
	Func<T5, TResult>^ parsedFunc5, 
	Func<T6, TResult>^ parsedFunc6, 
	Func<IEnumerable<Error^>^, TResult>^ notParsedFunc
)

F#

[<ExtensionAttribute>]
static member MapResult : 
        result : ParserResult<Object> * 
        parsedFunc1 : Func<'T1, 'TResult> * 
        parsedFunc2 : Func<'T2, 'TResult> * 
        parsedFunc3 : Func<'T3, 'TResult> * 
        parsedFunc4 : Func<'T4, 'TResult> * 
        parsedFunc5 : Func<'T5, 'TResult> * 
        parsedFunc6 : Func<'T6, '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.
parsedFunc3
Type: System.Func(T3, TResult)
Lambda executed on successful parsing of T3.
parsedFunc4
Type: System.Func(T4, TResult)
Lambda executed on successful parsing of T4.
parsedFunc5
Type: System.Func(T5, TResult)
Lambda executed on successful parsing of T5.
parsedFunc6
Type: System.Func(T6, TResult)
Lambda executed on successful parsing of T6.
notParsedFunc
Type: System.Func(IEnumerable(Error), TResult)
Lambda executed on failed parsing.

Type Parameters

 

T1
First verb type.
T2
Second verb type.
T3
Third verb type.
T4
Fourth verb type.
T5
Fifth verb type.
T6
Sixth 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