Programming-Idioms

History of Idiom 205 > diff from v21 to v22

Edit summary for version 22 :
New Csharp implementation by user [bigwavedave]

Version 21

2019-10-02, 07:23:08

Version 22

2019-10-07, 20:06:30

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";