Command-line arguments pass values to a program when it starts. In .NET, the `args` array holds them; spaces separate values unless quotes keep words together. Raw arrays become unwieldy when arguments need options, type conversion, or optional values. section 2.7
Common conventions make arguments easier to use:
- Use a single dash for short options and a double dash for long options; aliases can offer both forms, such as `-a` and `--all`. section 2.7
- Use a parser such as CommandLineParser to represent values and options, and to support required input, optional parameters, and help. section 2.7
- Arguments can identify files to process, while standard input can supply additional filenames for piping. section 4.1.5
Listing 2.14 Options record to hold parsed command-line parameters
using CommandLine; #1
namespace HelloDotnet; #2
public record Options #3
{
[Value(0, Required = true)] #4
public string? Text { get; init; } #5
[Option('f', "font")] #6
public string? Font { get; init; } #7
}
This options record maps a required positional text value and an optional `-f` or `--font` option to properties. section 2.7













