Click or drag to resize

YArgumentParserHasArgument Method

Overload List
  Name Description
Public method Code example HasArgument(String) Check if the argName is set.
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"
});
In results :
  • argumentParser.HasArgument(string.Empty) will return true because it has main argument
  • argumentParser.HasArgument("s") will return true
  • argumentParser.HasArgument("readonly") will return true
  • argumentParser.HasArgument("m") will return false
Public method Code example HasArgumentT(T) Check if the enum value argName is set.
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"
});
In results :
  • argumentParser.ArgumentIsSet(ArumentsTypes.main) will return true
  • argumentParser.HasArgument(ArumentsTypes.s) will return true
  • argumentParser.HasArgument(ArumentsTypes.readonly) will return true
  • argumentParser.HasArgument(ArumentsTypes.m) will return false
Top
See Also