Skip to content

M_CommandLine_ParserResultExtensions_MapResult__10

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

ParserResultExtensions.MapResult(T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult) Method (ParserResult(Object), Func(T1, TResult), Func(T2, TResult), Func(T3, TResult), Func(T4, TResult), Func(T5, TResult), Func(T6, TResult), Func(T7, TResult), Func(T8, TResult), Func(T9, 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, T7, T8, T9, 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<T7, TResult> parsedFunc7,
	Func<T8, TResult> parsedFunc8,
	Func<T9, TResult> parsedFunc9,
	Func<IEnumerable<Error>, TResult> notParsedFunc
)

VB

<ExtensionAttribute>
Public Shared Function MapResult(Of T1, T2, T3, T4, T5, T6, T7, T8, T9, 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),
	parsedFunc7 As Func(Of T7, TResult),
	parsedFunc8 As Func(Of T8, TResult),
	parsedFunc9 As Func(Of T9, 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 T7, typename T8, typename T9, 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<T7, TResult>^ parsedFunc7, 
	Func<T8, TResult>^ parsedFunc8, 
	Func<T9, TResult>^ parsedFunc9, 
	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> * 
        parsedFunc7 : Func<'T7, 'TResult> * 
        parsedFunc8 : Func<'T8, 'TResult> * 
        parsedFunc9 : Func<'T9, '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.
parsedFunc7
Type: System.Func(T7, TResult)
Lambda executed on successful parsing of T7.
parsedFunc8
Type: System.Func(T8, TResult)
Lambda executed on successful parsing of T8.
parsedFunc9
Type: System.Func(T9, TResult)
Lambda executed on successful parsing of T9.
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.
T7
Seventh verb type.
T8
Eighth verb type.
T9
Ninth 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