CHAPTER 3 CORE C# PROGRAMMING CONSTRUCTS, PART I
Figure 3-1. Setting command arguments via Visual Studio
After you have established such command-line arguments, they will automatically be passed to the
Main() method when debugging or running your application within the Visual Studio IDE.
An Interesting Aside: Some Additional Members of the
System.Environment Class
The Environment class exposes a number of extremely helpful methods beyond GetCommandLineArgs().
Specifically, this class allows you to obtain a number of details regarding the operating system currently
hosting your .NET application using various static members. To illustrate the usefulness of
System.Environment, update your Main() method to call a helper method named
ShowEnvironmentDetails().
static int Main(string[] args)
{
...
// Helper method within the Program class.
ShowEnvironmentDetails();
}
Console.ReadLine();
return -1;
Implement this method within your Program class to call various members of the Environment type.
79