0

wondering if anyone can help me out. In a C# console application, using NDESK.Options, if the user selects a certain flag (for this example let's say "other") I need to ensure that 4 values are passed (which in turn will populate 4 variables).

Example:

app.exe -other «val1» «val2» «val3» «val4»

where val1 will be Username<br>
where val2 will be Hostname<br>
where val3 will be CurrIPAddr<br>
where val4 will be OSVer<br>
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • 1
    check args for this (see https://www.dotnetperls.com/main) – H.G. Sandhagen Jan 06 '18 at 17:03
  • Sorry, I forgot to mention I would like to use NDESK.Options. I edited the original question to include that. – José Oliveira Jan 06 '18 at 17:28
  • I don't think this is possible. – jessehouwing Jan 06 '18 at 18:36
  • 1
    The example you gave can only be parsed by NDesk.Options (or Mono.Options) as extra, https://github.com/lextm/sharpsnmplib/blob/master/Samples/CSharpCore/snmpget/Program.cs#L93 as they belong to no switch at all. You cannot rely on that library to ensure whether certain values are provided by your end users. You have to do that on your own. The library was designed only for its own goals, not yours. – Lex Li Jan 07 '18 at 00:14
  • I ended up not using NDESK and worked some logic into the args[] passed into the application. I thank you all for answering. – José Oliveira Jan 13 '18 at 07:10

0 Answers0