Skip to content

Instantly share code, notes, and snippets.

@FurkanKozen
Last active May 17, 2020 17:18
Show Gist options
  • Save FurkanKozen/e4be76f71d92b1d6fb5f5a83a5376aaf to your computer and use it in GitHub Desktop.
Save FurkanKozen/e4be76f71d92b1d6fb5f5a83a5376aaf to your computer and use it in GitHub Desktop.
Using command-line arguments in a console application
class Program
{
static void Main(string[] args)
{
foreach (var arg in args)
{
Console.WriteLine(arg);
}
}
}
@FurkanKozen
Copy link
Author

Run the EXE file of this program from the command line like:

[Dir]>./CommandLineArgs.exe test-arg-1 test-arg-2

[Dir] is the directory where the executable file is.

The program writes:

test-arg-1
test-arg-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment