Skip to content

Instantly share code, notes, and snippets.

@mhrstmnn
Last active April 13, 2024 12:22
Show Gist options
  • Save mhrstmnn/3befa3fbcb8d2aec0cfabd0a1173a9e9 to your computer and use it in GitHub Desktop.
Save mhrstmnn/3befa3fbcb8d2aec0cfabd0a1173a9e9 to your computer and use it in GitHub Desktop.
Simple method to output CLI arguments in C#
class Program
{
private static void PrintArgs(string[] args)
{
Console.WriteLine("argc: " + args.Length);
if (args.Length > 0)
{
Console.WriteLine("\nargs:");
Console.WriteLine("- " + string.Join("\n- ", args));
}
}
public static int Main(string[] args)
{
Program.PrintArgs(args);
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment