Skip to content

M_CommandLine_ParserResultExtensions_MapResult__2_1

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

ParserResultExtensions.MapResult(TSource, TResult) Method (ParserResult(TSource), Func(TSource, 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<TSource, TResult>(
	this ParserResult<TSource> result,
	Func<TSource, TResult> parsedFunc,
	Func<IEnumerable<Error>, TResult> notParsedFunc
)

VB

<ExtensionAttribute>
Public Shared Function MapResult(Of TSource, TResult) ( 
	result As ParserResult(Of TSource),
	parsedFunc As Func(Of TSource, TResult),
	notParsedFunc As Func(Of IEnumerable(Of Error), TResult)
) As TResult

C++

public:
[ExtensionAttribute]
generic<typename TSource, typename TResult>
static TResult MapResult(
	ParserResult<TSource>^ result, 
	Func<TSource, TResult>^ parsedFunc, 
	Func<IEnumerable<Error^>^, TResult>^ notParsedFunc
)

F#

[<ExtensionAttribute>]
static member MapResult : 
        result : ParserResult<'TSource> * 
        parsedFunc : Func<'TSource, 'TResult> * 
        notParsedFunc : Func<IEnumerable<Error>, 'TResult> -> 'TResult 

Parameters

 

result
Type: CommandLine.ParserResult(TSource)
An ParserResult(T) instance.
parsedFunc
Type: System.Func(TSource, TResult)
Lambda executed on successful parsing.
notParsedFunc
Type: System.Func(IEnumerable(Error), TResult)
Lambda executed on failed parsing.

Type Parameters

 

TSource
Type of the target instance built with parsed value.
TResult
The type of the new value.

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(TSource). 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