Overview
The Environment type provides system environment access. All methods are static.
Methods
| Method | Signature | Description |
|---|
GetVariable | (string name) -> string | Get environment variable (empty if not set) |
SetVariable | (string name, string value) | Set environment variable |
Properties
| Property | Type | Description |
|---|
CurrentDirectory | string | Current working directory |
ProcessId | int | Current process ID |
TickCount | int | Milliseconds since system start |
Example
string path = Environment.GetVariable("PATH");
int pid = Environment.ProcessId;
string cwd = Environment.CurrentDirectory;
Environment.SetVariable("MY_VAR", "hello");