Visual Basic .NET includes a class that provides information related to the current environment: System.Environment. This class encapsulates information that you used to have to obtain from different sources in previous versions of Visual Basic. For example, System.Environment can return the user's System folder, which used to require an API call, as well as the current directory, which used to be obtained from the Common File Dialog control. Table 12-5 lists the most commonly called members of System.Environment. A number of the directives in this chapter rely on information supplied by System.Environment.
Member | Description |
---|---|
CommandLine | Returns the command line arguments for the process |
CurrentDirectory | Gets and sets the fully qualified path of the current directory |
MachineName | Gets the NetBIOS name of the computer |
OSVersion | Gets an OperatingSystem object that contains the current platform identifier and version number |
StackTrace | Gets the current stack trace information |
SystemDirectory | Gets the fully qualified path of the system directory |
UserDomainName | Gets the network domain name associated with the current user |
UserName | Gets the user name of the person who started the current thread |
Version | Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime |
WorkingSet | Gets the amount of physical memory mapped to the process context |
GetEnvironmentVariable | Returns the value of the specified environment variable |
GetEnvironmentVariables | Returns all environment variables and their values |
GetLogicalDrives | Returns an array of strings containing the names of the logical drives on the current computer |
Note
GetEnvironmentVariable, GetEnvironmentVariables, and GetLogicalDrives are methods. All other members listed in Table 12-5 are properties.
Goals of File OperationsThe goals of performing file operations include
|