O'Reilly logo

Pro C# 2010 and the .NET 4 Platform, Fifth Edition by Andrew Troelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.2. 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.

static void ShowEnvironmentDetails() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required