The value of the environment variable specified by variable, or null if the environment variable is not found.
Type Reason ArgumentNullException variable is a null reference. System.Security.SecurityException The caller does not have the required permission.
Environment variable names are not case-sensitive.
To retrieve all environment variables along with their values, call the Environment.GetEnvironmentVariables method.
Type | Reason |
---|---|
System.Security.Permissions.EnvironmentPermission | Requires permission to read environment variables. See System.Security.Permissions.EnvironmentPermissionAccess.Read. |