This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.
Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.
Project: Environment Variables Unit
Applies to: ~>3.0
Implements an enumerator for the names of all environment variable names in the current process.
Note: This class was originally provided to work with the deprecated TPJEnvVars component’s GetEnumerator method to enable TPJEnvVars instances to be enumerated in
for..instatements when compiled with Delphi 2005 or later. The class can also be used directly from code.
Important: Environments variables should not be modified while the enumerator is being used. Any addition or deletion of environment variables will not be reflected in the enumeration. Making such changes can result in obscure bugs.
|Create||Constructs and initialises a new enumeration object instance.|
|GetCurrent||Returns the name of the current environment variable in the enumeration. Can be used interchangeably with the Count property.|
|MoveNext||Moves to the next name in the enumeration if it exists. Returns
|Current||Records the name of the current environment variable in the enumeration. Can be used interchangeably with the GetCount method.|
This is an example of using TPJEnvVarsEnumerator directly from code. The code writes the names of every environment variable to the console.
var Enum: TPJEnvVarsEnumerator; begin Enum := TPJEnvVarsEnumerator.Create; try while Enum.MoveNext do WriteLn(Enum.Current); finally Enum.Free; end; end;