System.Environment.Environment.GetEnvironmentVariables C# (CSharp) Method

GetEnvironmentVariables() public static method

Return a set of all environment variables and their values
public static GetEnvironmentVariables ( ) : IDictionary
return IDictionary
		public static IDictionary GetEnvironmentVariables ()
		{
			StringBuilder sb = null;
			if (SecurityManager.SecurityEnabled) {
				// we must have access to each variable to get the lot
				sb = new StringBuilder ();
				// but (performance-wise) we do not want a stack-walk
				// for each of them so we concatenate them
			}

			Hashtable vars = new Hashtable ();
			foreach (string name in GetEnvironmentVariableNames ()) {
				vars [name] = internalGetEnvironmentVariable (name);
				if (sb != null) {
					sb.Append (name);
					sb.Append (";");
				}
			}

			if (sb != null) {
				new EnvironmentPermission (EnvironmentPermissionAccess.Read, sb.ToString ()).Demand ();
			}
			return vars;
		}
#else

Same methods

Environment.Environment::GetEnvironmentVariables ( EnvironmentVariableTarget target ) : IDictionary