CommandLineContext Class
Definition
- Namespace
- Codebelt.Bootstrapper
- Assemblies
- Codebelt.Bootstrapper.dll
Represents the command-line arguments available to a bootstrapper.
public class CommandLineContext
- Inheritance
-
CommandLineContext
Examples
The following example shows how to wrap the args array once at the start of Main, then let the rest of the bootstrapper flow inspect CommandLineContext.Args for switches without passing the raw array around. The outcome changes when the --debug switch is present, so the captured arguments directly control the startup mode.
using System;
using System.Linq;
using Codebelt.Bootstrapper;
namespace CommandLineContextDemo;
public static class Program
{
public static void Main(string[] args)
{
var context = new CommandLineContext(args);
var mode = context.Args.Contains("--debug", StringComparer.OrdinalIgnoreCase)
? "Debug bootstrap enabled."
: "Standard bootstrap enabled.";
Console.WriteLine(mode);
}
}
Constructors
| Name | Description |
|---|---|
| CommandLineContext(string[]) | Initializes a new instance of the CommandLineContext class with the specified command-line arguments. |
Properties
| Name | Description |
|---|---|
| Args | Gets the command-line arguments associated with this context. |