YArgumentParserGetArgumentT(T) Method
|
Get a
YArgument from the
argName. Throw a KeyNotFoundException if the given param is not found.
Example 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
Namespace: Upsilon.Common.LibraryAssembly: Upsilon.Common.Library (in Upsilon.Common.Library.dll) Version: 2.2.2+14985a67b419f90e14e6b1bde61d18cf6cf12b27
Syntax public YArgument GetArgument<T>(
T argName
)
where T : Enum
Parameters
- argName T
- The argument name as enum value.
Type Parameters
- T
Return Value
YArgumentReturns the
YArgument or
nullRemarks Giving the '0' value to the argName param will return the main YArguments
See Also