capturing an optional value

Feb 9, 2016 at 9:14 PM
I want to be able to pass an argument with an optional value associated with it. For example, I want to be able to call my app in each of these scenarios:
  1. app.exe
    No flag and no value
  2. app.exe -f
    Flag (-f) but no value
  3. app.exe -f foo.txt
    Flag (-f) and Value (foo.txt) were passed.
I am trying to use CommandLineParser to determine if the -f was passed and if it was is there a value associated with it.

any help is appreciated.