Summary
Retrieves the value of the environment variable or defaultValue if the environment variable does not exist.
Syntax
[CakeMethodAlias]
[CakeAliasCategory("Environment Variables")]
public static T EnvironmentVariable<T>(this ICakeContext context, string variable, T defaultValue)
Examples
Information(EnvironmentVariable<int>("BUILD_NUMBER", 42));
Attributes
Type Parameters
Name |
Description |
T |
The environment variable type. |
Parameters
Name |
Type |
Description |
context |
ICakeContext |
The context. |
variable |
string |
The environment variable. |
defaultValue |
T |
The value to return if the environment variable does not exist. |
Return Value
Type |
Description |
T |
The environment variable or defaultValue if the environment variable does not exist. |