Logo

Programming-Idioms

History of Idiom 205 > diff from v17 to v18

Edit summary for version 18 by programming-idioms.org:
[VB] Avoid underscores in snippets

Version 17

2019-10-01, 08:33:10

Version 18

2019-10-01, 08:33:31

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
Imports
imports System
Imports
imports System
Code
Dim _foo as String
Try
	_foo = Environment.GetEnvironmentVariable("FOO")
Catch ex as Exception
	_foo = "none"
End Try
Code
Dim _foo as String
Try
	foo = Environment.GetEnvironmentVariable("FOO")
Catch ex as Exception
	foo = "none"
End Try
Doc URL
https://docs.microsoft.com/en-us/dotnet/api/system.environment?view=netframework-4.8
Doc URL
https://docs.microsoft.com/en-us/dotnet/api/system.environment?view=netframework-4.8