Skip to content

Instantly share code, notes, and snippets.

@rruntsch
Last active September 20, 2021 12:56
Show Gist options
  • Save rruntsch/cfbcdec2c17851d484dbdd52f4276d17 to your computer and use it in GitHub Desktop.
Save rruntsch/cfbcdec2c17851d484dbdd52f4276d17 to your computer and use it in GitHub Desktop.
using System;
namespace MainArgs
{
class Program
{
static void Main(string[] args)
{
if (args.Length > 0)
{
// The length of the args variable is greater than 0, so arguments exist.
// Print an "Input arguments:" message.
Console.WriteLine("Input arguments:");
// Loop through the array of argument strings.
// Print one argument per line.
for (int idx = 0; idx < args.Length; idx++)
{
Console.WriteLine(args[idx]);
}
}
else
{
// No input arguments exist. Print a "No input..." message.
Console.WriteLine("No input arguments were provided.");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment