Programming-Idioms

History of Idiom 205 > diff from v22 to v23

Edit summary for version 23 :
[Csharp] Wrong variable name

Version 22

2019-10-07, 20:06:30

Version 23

2019-10-07, 20:09:03

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Extra Keywords
envvar os system
Extra Keywords
envvar os system
Code
string foo = Environment.GetEnvironmentVariable("windir");
if (string.IsNullOrEmpty(foo)) foo = "none";
Code
string foo = Environment.GetEnvironmentVariable("FOO");
if (string.IsNullOrEmpty(foo)) foo = "none";