Skip to content

M_CommandLine_ParserResultExtensions_MapResult__4

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

ParserResultExtensions.MapResult(T1, T2, T3, TResult) Method (ParserResult(Object), Func(T1, TResult), Func(T2, TResult), Func(T3, 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#

publicstaticTResultMapResult<T1,T2,T3,TResult>(thisParserResult<Object>result,Func<T1,TResult>parsedFunc1,Func<T2,TResult>parsedFunc2,Func<T3,TResult>parsedFunc3,Func<IEnumerable<Error>,TResult>notParsedFunc)

VB

<ExtensionAttribute>PublicSharedFunctionMapResult(OfT1,T2,T3,TResult)(resultAsParserResult(OfObject),parsedFunc1AsFunc(OfT1,TResult),parsedFunc2AsFunc(OfT2,TResult),parsedFunc3AsFunc(OfT3,TResult),notParsedFuncAsFunc(OfIEnumerable(OfError),TResult))AsTResult

C++

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

F#

[<ExtensionAttribute>]static memberMapResult:result :ParserResult<Object>* parsedFunc1 : Func<'T1, 'TResult>* parsedFunc2 : Func<'T2, 'TResult>* parsedFunc3 : Func<'T3, '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.
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.
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