Collections
Let's enhance our rocket launcher to support multiple planets.
Collection of Options#
public void LaunchRocket([Option(ShortName = "p")] List<string> planets)
This is what help information looks like-
INPUT
dotnet example.dll LaunchRocket --help
OUTPUT
Usage: dotnet example.dll LaunchRocket [options]
Options:
-h | -? | --help Show help information
-p String (Multiple)
And this is how you pass multiple options:
dotnet example.dll LaunchRocket -p mars -p earth -p jupiter
Collection of Arguments#
public void LaunchRocket(List<string> planets)
INPUT
dotnet example.dll LaunchRocket --help
OUTPUT
Usage: dotnet example.dll LaunchRocket [arguments] [options]
Arguments:
planets String (Multiple)
Options:
-h | -? | --help Show help information
And this is how you pass multiple arguments:
dotnet example.dll LaunchRocket mars earth jupiter