M_CommandLine_ParserResultExtensions_MapResult__2_1 - adutton/commandline GitHub Wiki
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
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 TResultC++
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
- 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.
- TSource
- Type of the target instance built with parsed value.
- TResult
- The type of the new value.
Type: TResult
The new value.
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).
ParserResultExtensions Class
MapResult Overload
CommandLine Namespace