Click or drag to resize

YArgumentParserGetArgument Method

Overload List
  Name Description
Public method Code example GetArgument(String) Get a YArgument from the argName. Throw a KeyNotFoundException if the given param is not found.
Example
C#
YArgumentParser argumentParser = new YArgumentParser(new string[]
{ 
    "First value of the main argument",
    "Second value of the main argument",
    "-s",
    "source",
    "/d",
    "destination",
    "-readonly"
});
YArgument argument = argumentParser.GetArgument("s");
YArgument mainArgument = argumentParser.GetArgument(string.Empty);
YArgument nullArgument = argumentParser.GetArgument("m");
In results :
  • argument.Values will be { "source" }
  • mainArgument.Values will be { "First value of the main argument", "Second value of the main argument"}
  • nullArgument will be null
Public method Code example GetArgumentT(T) Get a YArgument from the argName. Throw a KeyNotFoundException if the given param is not found.
Example
C#
enum ArumentsTypes
{
    main = 0,
    s,
    m,
    readonly,
}
YArgumentParser argumentParser = new YArgumentParser(new string[]
{ 
    "First value of the main argument",
    "Second value of the main argument",
    "-s",
    "source",
    "/d",
    "destination",
    "-readonly"
});
YArgument argument = argumentParser.GetArgument(ArumentsTypes.s);
YArgument mainArgument = argumentParser.GetArgument(ArumentsTypes.main);
YArgument nullArgument = argumentParser.GetArgument(ArumentsTypes.m);
In results :
  • argument.Values will be { "source" }
  • mainArgument.Values will be { "First value of the main argument", "Second value of the main argument"}
  • nullArgument will be null
Top
See Also