public static T Parse<T>(
ParseOptions? options = null
)
where T : class
Public Shared Function Parse(Of T As Class) (
Optional options As ParseOptions = Nothing
) As T
Dim options As ParseOptions
Dim returnValue As T
returnValue = CommandLineParser.Parse(options)
public:
generic<typename T>
where T : ref class
static T Parse(
ParseOptions^ options = nullptr
)
This is a convenience function that instantiates a CommandLineParser, calls the Parse method, and returns the result. If an error occurs or parsing is canceled, it prints errors to the Error stream, and usage help to the UsageWriter if the HelpRequested property is . It then returns .
If the Error parameter is , output is written to a LineWrappingTextWriter for the standard error stream, wrapping at the console's window width. If the stream is redirected, output may still be wrapped, depending on the value returned by WindowWidth.
Color is applied to the output depending on the value of the UseColor property, the UseErrorColor property, and the capabilities of the console.
If you want more control over the parsing process, including custom error/usage output or handling the ArgumentParsed event, you should manually create an instance of the CommandLineParserT class and call its Parse method.
CommandLineArgumentException | An error occurred parsing the command line. Check the Category property for the exact reason for the error. |