BadScript 2
Loading...
Searching...
No Matches
CommandLine.ParserResult< T > Class Template Referenceabstract

Models a parser result. When inherited by CommandLine.Parsed<T>, it contains an instance of type T with parsed values. When inherited by CommandLine.NotParsed<T>, it contains a sequence of CommandLine.Error. More...

Inheritance diagram for CommandLine.ParserResult< T >:
CommandLine.NotParsed< T > CommandLine.Parsed< T >

Package Functions

 ParserResult (IEnumerable< Error > errors, TypeInfo typeInfo)
 
 ParserResult (T value, TypeInfo typeInfo)
 

Properties

ParserResultType Tag [get]
 Parser result type discriminator, defined as CommandLine.ParserResultType enumeration.
 
TypeInfo TypeInfo [get]
 
Value [get]
 Gets the instance with parsed values. If one or more errors occures, default is returned.
 
IEnumerable< ErrorErrors [get]
 Gets the sequence of parsing errors. If there are no errors, then an empty IEnumerable is returned.
 

Detailed Description

Models a parser result. When inherited by CommandLine.Parsed<T>, it contains an instance of type T with parsed values. When inherited by CommandLine.NotParsed<T>, it contains a sequence of CommandLine.Error.

Template Parameters
TThe type with attributes that define the syntax of parsing rules.

Definition at line 56 of file ParserResult.cs.

Constructor & Destructor Documentation

◆ ParserResult() [1/2]

CommandLine.ParserResult< T >.ParserResult ( IEnumerable< Error errors,
TypeInfo  typeInfo 
)
package

Definition at line 58 of file ParserResult.cs.

59 {
60 Tag = ParserResultType.NotParsed;
61 TypeInfo = typeInfo ?? TypeInfo.Create(typeof(T));
62 Errors = errors ?? new Error[0];
63 Value = default;
64 }
IEnumerable< Error > Errors
Gets the sequence of parsing errors. If there are no errors, then an empty IEnumerable is returned.
ParserResultType Tag
Parser result type discriminator, defined as CommandLine.ParserResultType enumeration.
T Value
Gets the instance with parsed values. If one or more errors occures, default is returned.
static TypeInfo Create(Type current)
ParserResultType
Discriminator enumeration of CommandLine.ParserResultType derivates.

◆ ParserResult() [2/2]

CommandLine.ParserResult< T >.ParserResult ( value,
TypeInfo  typeInfo 
)
package

Definition at line 66 of file ParserResult.cs.

67 {
68 Value = value ?? throw new ArgumentNullException(nameof(value));
69 Tag = ParserResultType.Parsed;
70 TypeInfo = typeInfo ?? TypeInfo.Create(value.GetType());
71 Errors = new Error[0];
72 }

Property Documentation

◆ Errors

IEnumerable<Error> CommandLine.ParserResult< T >.Errors
get

Gets the sequence of parsing errors. If there are no errors, then an empty IEnumerable is returned.

Definition at line 89 of file ParserResult.cs.

89{ get; }

◆ Tag

Parser result type discriminator, defined as CommandLine.ParserResultType enumeration.

Definition at line 77 of file ParserResult.cs.

77{ get; }

◆ TypeInfo

Definition at line 79 of file ParserResult.cs.

79{ get; }

◆ Value

T CommandLine.ParserResult< T >.Value
get

Gets the instance with parsed values. If one or more errors occures, default is returned.

Definition at line 84 of file ParserResult.cs.

84{ get; }

The documentation for this class was generated from the following file: