Environment Class
Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
The Environment type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() ![]() ![]() | CurrentDirectory | When called by trusted applications, gets the fully qualified path of the current working directory. |
![]() ![]() | ExitCode | Gets or sets the exit code of the process. |
![]() ![]() ![]() ![]() | HasShutdownStarted | Gets a value indicating whether the common language runtime is shutting down or the current application domain is unloading. |
![]() ![]() ![]() ![]() | NewLine | Gets the newline string defined for this environment. |
![]() ![]() ![]() ![]() | OSVersion | Gets an OperatingSystem object that contains the current platform identifier and version number. |
![]() ![]() ![]() ![]() | ProcessorCount | Gets the number of processors on the current machine. |
![]() ![]() ![]() ![]() | TickCount | Gets the number of milliseconds elapsed since the system started. |
![]() ![]() ![]() ![]() | Version | Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime. |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() ![]() | GetFolderPath | Gets the path to the system special folder identified by the specified enumeration. |
The following example demonstrates displays a list of information about the current environment.
Note: |
|---|
To run this example, see Building Examples That Use a Demo Method and a TextBlock Control. |
// Sample for Environment class summary using System; class Example { public static void Demo(System.Windows.Controls.TextBlock outputBlock) { outputBlock.Text += "-- Environment members --" + "\n"; outputBlock.Text += String.Format("ExitCode: {0}", Environment.ExitCode) + "\n"; outputBlock.Text += String.Format("HasShutdownStarted: {0}", Environment.HasShutdownStarted) + "\n"; outputBlock.Text += String.Format("NewLine: {0} first line{0} second line{0} third line", Environment.NewLine) + "\n"; outputBlock.Text += String.Format("OSVersion: {0}", Environment.OSVersion.ToString()) + "\n"; outputBlock.Text += String.Format("TickCount: {0}", Environment.TickCount) + "\n"; outputBlock.Text += String.Format("Version: {0}", Environment.Version.ToString()) + "\n"; } }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.





Note: