mscorlib(4.0.0.0) API with additions
System.Environment Class Reference

Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited. More...

Collaboration diagram for System.Environment:
[legend]

Public Types

enum  SpecialFolderOption { SpecialFolderOption.None = 0, SpecialFolderOption.Create = 0x8000, SpecialFolderOption.DoNotVerify = 0x4000 }
 Specifies options to use for getting the path to a special folder. More...
 
enum  SpecialFolder {
  SpecialFolder.ApplicationData = 26, SpecialFolder.CommonApplicationData = 35, SpecialFolder.LocalApplicationData = 28, SpecialFolder.Cookies = 33,
  SpecialFolder.Desktop = 0, SpecialFolder.Favorites = 6, SpecialFolder.History = 34, SpecialFolder.InternetCache = 0x20,
  SpecialFolder.Programs = 2, SpecialFolder.MyComputer = 17, SpecialFolder.MyMusic = 13, SpecialFolder.MyPictures = 39,
  SpecialFolder.MyVideos = 14, SpecialFolder.Recent = 8, SpecialFolder.SendTo = 9, SpecialFolder.StartMenu = 11,
  SpecialFolder.Startup = 7, SpecialFolder.System = 37, SpecialFolder.Templates = 21, SpecialFolder.DesktopDirectory = 0x10,
  SpecialFolder.Personal = 5, SpecialFolder.MyDocuments = 5, SpecialFolder.ProgramFiles = 38, SpecialFolder.CommonProgramFiles = 43,
  SpecialFolder.AdminTools = 48, SpecialFolder.CDBurning = 59, SpecialFolder.CommonAdminTools = 47, SpecialFolder.CommonDocuments = 46,
  SpecialFolder.CommonMusic = 53, SpecialFolder.CommonOemLinks = 58, SpecialFolder.CommonPictures = 54, SpecialFolder.CommonStartMenu = 22,
  SpecialFolder.CommonPrograms = 23, SpecialFolder.CommonStartup = 24, SpecialFolder.CommonDesktopDirectory = 25, SpecialFolder.CommonTemplates = 45,
  SpecialFolder.CommonVideos = 55, SpecialFolder.Fonts = 20, SpecialFolder.NetworkShortcuts = 19, SpecialFolder.PrinterShortcuts = 27,
  SpecialFolder.UserProfile = 40, SpecialFolder.CommonProgramFilesX86 = 44, SpecialFolder.ProgramFilesX86 = 42, SpecialFolder.Resources = 56,
  SpecialFolder.LocalizedResources = 57, SpecialFolder.SystemX86 = 41, SpecialFolder.Windows = 36
}
 Specifies enumerated constants used to retrieve directory paths to system special folders. More...
 

Public Member Functions

static void FailFast (string message)
 Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message in error reporting to Microsoft. More...
 
static void FailFast (string message, Exception exception)
 Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and exception information in error reporting to Microsoft. More...
 

Static Public Member Functions

static void Exit (int exitCode)
 Terminates this process and returns an exit code to the operating system. More...
 
static string ExpandEnvironmentVariables (string name)
 Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string. More...
 
static string [] GetCommandLineArgs ()
 Returns a string array containing the command-line arguments for the current process. More...
 
static string GetEnvironmentVariable (string variable)
 Retrieves the value of an environment variable from the current process. More...
 
static string GetEnvironmentVariable (string variable, EnvironmentVariableTarget target)
 Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine. More...
 
static IDictionary GetEnvironmentVariables ()
 Retrieves all environment variable names and their values from the current process. More...
 
static IDictionary GetEnvironmentVariables (EnvironmentVariableTarget target)
 Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine. More...
 
static void SetEnvironmentVariable (string variable, string value)
 Creates, modifies, or deletes an environment variable stored in the current process. More...
 
static void SetEnvironmentVariable (string variable, string value, EnvironmentVariableTarget target)
 Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine. More...
 
static string [] GetLogicalDrives ()
 Returns an array of string containing the names of the logical drives on the current computer. More...
 
static string GetFolderPath (SpecialFolder folder)
 Gets the path to the system special folder that is identified by the specified enumeration. More...
 
static string GetFolderPath (SpecialFolder folder, SpecialFolderOption option)
 Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders. More...
 

Static Public Attributes

static Version Version => new Version(4, 0, 30319, 42000)
 Gets a T:System.Version object that describes the major, minor, build, and revision numbers of the common language runtime. More...
 
static bool Is64BitProcess => true
 Determines whether the current process is a 64-bit process. More...
 

Properties

static int TickCount [get]
 Gets the number of milliseconds elapsed since the system started. More...
 
static int ExitCode [get, set]
 Gets or sets the exit code of the process. More...
 
static string CommandLine [get]
 Gets the command line for this process. More...
 
static string CurrentDirectory [get, set]
 Gets or sets the fully qualified path of the current working directory. More...
 
static string SystemDirectory [get]
 Gets the fully qualified path of the system directory. More...
 
static string MachineName [get]
 Gets the NetBIOS name of this local computer. More...
 
static int ProcessorCount [get]
 Gets the number of processors on the current machine. More...
 
static int SystemPageSize [get]
 Gets the number of bytes in the operating system's memory page. More...
 
static string NewLine [get]
 Gets the newline string defined for this environment. More...
 
static long WorkingSet [get]
 Gets the amount of physical memory mapped to the process context. More...
 
static OperatingSystem OSVersion [get]
 Gets an T:System.OperatingSystem object that contains the current platform identifier and version number. More...
 
static string StackTrace [get]
 Gets current stack trace information. More...
 
static bool Is64BitOperatingSystem [get]
 Determines whether the current operating system is a 64-bit operating system. More...
 
static bool HasShutdownStarted [get]
 Gets a value that indicates whether the current application domain is being unloaded or the common language runtime (CLR) is shutting down. More...
 
static string UserName [get]
 Gets the user name of the person who is currently logged on to the Windows operating system. More...
 
static bool UserInteractive [get]
 Gets a value indicating whether the current process is running in user interactive mode. More...
 
static string UserDomainName [get]
 Gets the network domain name associated with the current user. More...
 
static int CurrentManagedThreadId [get]
 Gets a unique identifier for the current managed thread. More...
 

Detailed Description

Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.

Definition at line 21 of file Environment.cs.

Member Enumeration Documentation

◆ SpecialFolder

Specifies enumerated constants used to retrieve directory paths to system special folders.

Enumerator
ApplicationData 

The directory that serves as a common repository for application-specific data for the current roaming user.

CommonApplicationData 

The directory that serves as a common repository for application-specific data that is used by all users.

LocalApplicationData 

The directory that serves as a common repository for application-specific data that is used by the current, non-roaming user.

Cookies 

The directory that serves as a common repository for Internet cookies.

Desktop 

The logical Desktop rather than the physical file system location.

Favorites 

The directory that serves as a common repository for the user's favorite items.

History 

The directory that serves as a common repository for Internet history items.

InternetCache 

The directory that serves as a common repository for temporary Internet files.

Programs 

The directory that contains the user's program groups.

MyComputer 

The My Computer folder.

MyMusic 

The My Music folder.

MyPictures 

The My Pictures folder.

MyVideos 

The file system directory that serves as a repository for videos that belong to a user. Added in the .NET Framework 4.

Recent 

The directory that contains the user's most recently used documents.

SendTo 

The directory that contains the Send To menu items.

StartMenu 

The directory that contains the Start menu items.

Startup 

The directory that corresponds to the user's Startup program group.

System 

The System directory.

Templates 

The directory that serves as a common repository for document templates.

DesktopDirectory 

The directory used to physically store file objects on the desktop.

Personal 

The directory that serves as a common repository for documents.

MyDocuments 

The My Documents folder.

ProgramFiles 

The program files directory.On a non-x86 system, passing F:System.Environment.SpecialFolder.ProgramFiles to the M:System.Environment.GetFolderPath(System.Environment.SpecialFolder) method returns the path for non-x86 programs. To get the x86 program files directory on a non-x86 system, use the F:System.Environment.SpecialFolder.ProgramFilesX86 member.

CommonProgramFiles 

The directory for components that are shared across applications.To get the x86 common program files directory on a non-x86 system, use the F:System.Environment.SpecialFolder.ProgramFilesX86 member.

AdminTools 

The file system directory that is used to store administrative tools for an individual user. The Microsoft Management Console (MMC) will save customized consoles to this directory, and it will roam with the user. Added in the .NET Framework 4.

CDBurning 

The file system directory that acts as a staging area for files waiting to be written to a CD. Added in the .NET Framework 4.

CommonAdminTools 

The file system directory that contains administrative tools for all users of the computer. Added in the .NET Framework 4.

CommonDocuments 

The file system directory that contains documents that are common to all users. This special folder is valid for Windows NT systems, Windows 95, and Windows 98 systems with Shfolder.dll installed. Added in the .NET Framework 4.

CommonMusic 

The file system directory that serves as a repository for music files common to all users. Added in the .NET Framework 4.

CommonOemLinks 

This value is recognized in Windows Vista for backward compatibility, but the special folder itself is no longer used. Added in the .NET Framework 4.

CommonPictures 

The file system directory that serves as a repository for image files common to all users. Added in the .NET Framework 4.

CommonStartMenu 

The file system directory that contains the programs and folders that appear on the Start menu for all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.

CommonPrograms 

A folder for components that are shared across applications. This special folder is valid only for Windows NT, Windows 2000, and Windows XP systems. Added in the .NET Framework 4.

CommonStartup 

The file system directory that contains the programs that appear in the Startup folder for all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.

CommonDesktopDirectory 

The file system directory that contains files and folders that appear on the desktop for all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.

CommonTemplates 

The file system directory that contains the templates that are available to all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.

CommonVideos 

The file system directory that serves as a repository for video files common to all users. Added in the .NET Framework 4.

Fonts 

A virtual folder that contains fonts. Added in the .NET Framework 4.

NetworkShortcuts 

A file system directory that contains the link objects that may exist in the My Network Places virtual folder. Added in the .NET Framework 4.

PrinterShortcuts 

The file system directory that contains the link objects that can exist in the Printers virtual folder. Added in the .NET Framework 4.

UserProfile 

The user's profile folder. Applications should not create files or folders at this level; they should put their data under the locations referred to by F:System.Environment.SpecialFolder.ApplicationData. Added in the .NET Framework 4.

CommonProgramFilesX86 

The Program Files folder. Added in the .NET Framework 4.

ProgramFilesX86 

The x86 Program Files folder. Added in the .NET Framework 4.

Resources 

The file system directory that contains resource data. Added in the .NET Framework 4.

LocalizedResources 

The file system directory that contains localized resource data. Added in the .NET Framework 4.

SystemX86 

The Windows System folder. Added in the .NET Framework 4.

Windows 

The Windows directory or SYSROOT. This corresponds to the windir% or SYSTEMROOT% environment variables. Added in the .NET Framework 4.

Definition at line 164 of file Environment.cs.

◆ SpecialFolderOption

Specifies options to use for getting the path to a special folder.

Enumerator
None 

The path to the folder is verified. If the folder exists, the path is returned. If the folder does not exist, an empty string is returned. This is the default behavior.

Create 

The path to the folder is created if it does not already exist.

DoNotVerify 

The path to the folder is returned without verifying whether the path exists. If the folder is located on a network, specifying this option can reduce lag time.

Definition at line 152 of file Environment.cs.

Member Function Documentation

◆ Exit()

static void System.Environment.Exit ( int  exitCode)
static

Terminates this process and returns an exit code to the operating system.

Parameters
exitCodeThe exit code to return to the operating system. Use 0 (zero) to indicate that the process completed successfully.
Exceptions
T:System.Security.SecurityExceptionThe caller does not have sufficient security permission to perform this function.

Definition at line 670 of file Environment.cs.

◆ ExpandEnvironmentVariables()

static string System.Environment.ExpandEnvironmentVariables ( string  name)
static

Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string.

Parameters
nameA string containing the names of zero or more environment variables. Each environment variable is quoted with the percent sign character (%).
Returns
A string with each environment variable replaced by its value.
Exceptions
T:System.ArgumentNullExceptionname is null.

Definition at line 718 of file Environment.cs.

◆ FailFast() [1/2]

static void System.Environment.FailFast ( string  message)

Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message in error reporting to Microsoft.

Parameters
messageA message that explains why the process was terminated, or null if no explanation is provided.

◆ FailFast() [2/2]

static void System.Environment.FailFast ( string  message,
Exception  exception 
)

Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and exception information in error reporting to Microsoft.

Parameters
messageA message that explains why the process was terminated, or null if no explanation is provided.
exceptionAn exception that represents the error that caused the termination. This is typically the exception in a catch block.

◆ GetCommandLineArgs()

static string [] System.Environment.GetCommandLineArgs ( )
static

Returns a string array containing the command-line arguments for the current process.

Returns
An array of string where each element contains a command-line argument. The first element is the executable file name, and the following zero or more elements contain the remaining command-line arguments.
Exceptions
T:System.NotSupportedExceptionThe system does not support command-line arguments.

Definition at line 806 of file Environment.cs.

◆ GetEnvironmentVariable() [1/2]

static string System.Environment.GetEnvironmentVariable ( string  variable)
static

Retrieves the value of an environment variable from the current process.

Parameters
variableThe name of the environment variable.
Returns
The value of the environment variable specified by variable , or null if the environment variable is not found.
Exceptions
T:System.ArgumentNullExceptionvariable is null.
T:System.Security.SecurityExceptionThe caller does not have the required permission to perform this operation.

Definition at line 828 of file Environment.cs.

◆ GetEnvironmentVariable() [2/2]

static string System.Environment.GetEnvironmentVariable ( string  variable,
EnvironmentVariableTarget  target 
)
static

Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine.

Parameters
variableThe name of an environment variable.
targetOne of the T:System.EnvironmentVariableTarget values.
Returns
The value of the environment variable specified by the variable and target parameters, or null if the environment variable is not found.
Exceptions
T:System.ArgumentNullExceptionvariable is null.
T:System.ArgumentExceptiontarget is not a valid T:System.EnvironmentVariableTarget value.
T:System.Security.SecurityExceptionThe caller does not have the required permission to perform this operation.

Definition at line 865 of file Environment.cs.

◆ GetEnvironmentVariables() [1/2]

static IDictionary System.Environment.GetEnvironmentVariables ( )
static

Retrieves all environment variable names and their values from the current process.

Returns
A dictionary that contains all environment variable names and their values; otherwise, an empty dictionary if no environment variables are found.
Exceptions
T:System.Security.SecurityExceptionThe caller does not have the required permission to perform this operation.
T:System.OutOfMemoryExceptionThe buffer is out of memory.

Definition at line 954 of file Environment.cs.

◆ GetEnvironmentVariables() [2/2]

static IDictionary System.Environment.GetEnvironmentVariables ( EnvironmentVariableTarget  target)
static

Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine.

Parameters
targetOne of the T:System.EnvironmentVariableTarget values.
Returns
A dictionary that contains all environment variable names and their values from the source specified by the target parameter; otherwise, an empty dictionary if no environment variables are found.
Exceptions
T:System.Security.SecurityExceptionThe caller does not have the required permission to perform this operation for the specified value of target .
T:System.ArgumentExceptiontarget contains an illegal value.

Definition at line 1032 of file Environment.cs.

◆ GetFolderPath() [1/2]

static string System.Environment.GetFolderPath ( SpecialFolder  folder)
static

Gets the path to the system special folder that is identified by the specified enumeration.

Parameters
folderAn enumerated constant that identifies a system special folder.
Returns
The path to the specified system special folder, if that folder physically exists on your computer; otherwise, an empty string ("").A folder will not physically exist if the operating system did not create it, the existing folder was deleted, or the folder is a virtual directory, such as My Computer, which does not correspond to a physical path.
Exceptions
T:System.ArgumentExceptionfolder is not a member of T:System.Environment.SpecialFolder.
T:System.PlatformNotSupportedExceptionThe current platform is not supported.

Definition at line 1336 of file Environment.cs.

◆ GetFolderPath() [2/2]

static string System.Environment.GetFolderPath ( SpecialFolder  folder,
SpecialFolderOption  option 
)
static

Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders.

Parameters
folderAn enumerated constant that identifies a system special folder.
optionSpecifies options to use for accessing a special folder.
Returns
The path to the specified system special folder, if that folder physically exists on your computer; otherwise, an empty string ("").A folder will not physically exist if the operating system did not create it, the existing folder was deleted, or the folder is a virtual directory, such as My Computer, which does not correspond to a physical path.
Exceptions
T:System.ArgumentExceptionfolder is not a member of T:System.Environment.SpecialFolder
T:System.PlatformNotSupportedExceptionT:System.PlatformNotSupportedException

Definition at line 1355 of file Environment.cs.

◆ GetLogicalDrives()

static string [] System.Environment.GetLogicalDrives ( )
static

Returns an array of string containing the names of the logical drives on the current computer.

Returns
An array of strings where each element contains the name of a logical drive. For example, if the computer's hard drive is the first logical drive, the first element returned is "C:\".
Exceptions
T:System.IO.IOExceptionAn I/O error occurs.
T:System.Security.SecurityExceptionThe caller does not have the required permissions.

Definition at line 1201 of file Environment.cs.

◆ SetEnvironmentVariable() [1/2]

static void System.Environment.SetEnvironmentVariable ( string  variable,
string  value 
)
static

Creates, modifies, or deletes an environment variable stored in the current process.

Parameters
variableThe name of an environment variable.
valueA value to assign to variable .
Exceptions
T:System.ArgumentNullExceptionvariable is null.
T:System.ArgumentExceptionvariable contains a zero-length string, an initial hexadecimal zero character (0x00), or an equal sign ("="). -or-The length of variable or value is greater than or equal to 32,767 characters.-or-An error occurred during the execution of this operation.
T:System.Security.SecurityExceptionThe caller does not have the required permission to perform this operation.

Definition at line 1066 of file Environment.cs.

◆ SetEnvironmentVariable() [2/2]

static void System.Environment.SetEnvironmentVariable ( string  variable,
string  value,
EnvironmentVariableTarget  target 
)
static

Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine.

Parameters
variableThe name of an environment variable.
valueA value to assign to variable .
targetOne of the enumeration values that specifies the location of the environment variable.
Exceptions
T:System.ArgumentNullExceptionvariable is null.
T:System.ArgumentExceptionvariable contains a zero-length string, an initial hexadecimal zero character (0x00), or an equal sign ("="). -or-The length of variable is greater than or equal to 32,767 characters.-or- target is not a member of the T:System.EnvironmentVariableTarget enumeration. -or- target is F:System.EnvironmentVariableTarget.Machine or F:System.EnvironmentVariableTarget.User, and the length of variable is greater than or equal to 255.-or- target is F:System.EnvironmentVariableTarget.Process and the length of value is greater than or equal to 32,767 characters. -or-An error occurred during the execution of this operation.
T:System.Security.SecurityExceptionThe caller does not have the required permission to perform this operation.

Definition at line 1134 of file Environment.cs.

Member Data Documentation

◆ Is64BitProcess

bool System.Environment.Is64BitProcess => true
static

Determines whether the current process is a 64-bit process.

Returns
true if the process is 64-bit; otherwise, false.

Definition at line 546 of file Environment.cs.

◆ Version

Version System.Environment.Version => new Version(4, 0, 30319, 42000)
static

Gets a T:System.Version object that describes the major, minor, build, and revision numbers of the common language runtime.

Returns
An object that displays the version of the common language runtime.

Definition at line 459 of file Environment.cs.

Property Documentation

◆ CommandLine

string System.Environment.CommandLine
staticget

Gets the command line for this process.

Returns
A string containing command-line arguments.

Definition at line 337 of file Environment.cs.

◆ CurrentDirectory

string System.Environment.CurrentDirectory
staticgetset

Gets or sets the fully qualified path of the current working directory.

Returns
A string containing a directory path.
Exceptions
T:System.ArgumentExceptionAttempted to set to an empty string ("").
T:System.ArgumentNullExceptionAttempted to set to null.
T:System.IO.IOExceptionAn I/O error occurred.
T:System.IO.DirectoryNotFoundExceptionAttempted to set a local path that cannot be found.
T:System.Security.SecurityExceptionThe caller does not have the appropriate permission.

Definition at line 356 of file Environment.cs.

◆ CurrentManagedThreadId

int System.Environment.CurrentManagedThreadId
staticget

Gets a unique identifier for the current managed thread.

Returns
An integer that represents a unique identifier for this managed thread.

Definition at line 651 of file Environment.cs.

◆ ExitCode

int System.Environment.ExitCode
staticgetset

Gets or sets the exit code of the process.

Returns
A 32-bit signed integer containing the exit code. The default value is 0 (zero), which indicates that the process completed successfully.

Definition at line 316 of file Environment.cs.

◆ HasShutdownStarted

bool System.Environment.HasShutdownStarted
staticget

Gets a value that indicates whether the current application domain is being unloaded or the common language runtime (CLR) is shutting down.

Returns
true if the current application domain is being unloaded or the CLR is shutting down; otherwise, false.

Definition at line 565 of file Environment.cs.

◆ Is64BitOperatingSystem

bool System.Environment.Is64BitOperatingSystem
staticget

Determines whether the current operating system is a 64-bit operating system.

Returns
true if the operating system is 64-bit; otherwise, false.

Definition at line 552 of file Environment.cs.

◆ MachineName

string System.Environment.MachineName
staticget

Gets the NetBIOS name of this local computer.

Returns
A string containing the name of this computer.
Exceptions
T:System.InvalidOperationExceptionThe name of this computer cannot be obtained.

Definition at line 403 of file Environment.cs.

◆ NewLine

string System.Environment.NewLine
staticget

Gets the newline string defined for this environment.

Returns
A string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms.

Definition at line 449 of file Environment.cs.

◆ OSVersion

OperatingSystem System.Environment.OSVersion
staticget

Gets an T:System.OperatingSystem object that contains the current platform identifier and version number.

Returns
An object that contains the platform identifier and version number.
Exceptions
T:System.InvalidOperationExceptionThis property was unable to obtain the system version.-or- The obtained platform identifier is not a member of T:System.PlatformID

Definition at line 477 of file Environment.cs.

◆ ProcessorCount

int System.Environment.ProcessorCount
staticget

Gets the number of processors on the current machine.

Returns
The 32-bit signed integer that specifies the number of processors on the current machine. There is no default. If the current machine contains multiple processor groups, this property returns the number of logical processors that are available for use by the common language runtime (CLR).

Definition at line 422 of file Environment.cs.

◆ StackTrace

string System.Environment.StackTrace
staticget

Gets current stack trace information.

Returns
A string containing stack trace information. This value can be F:System.String.Empty.

Definition at line 533 of file Environment.cs.

◆ SystemDirectory

string System.Environment.SystemDirectory
staticget

Gets the fully qualified path of the system directory.

Returns
A string containing a directory path.

Definition at line 370 of file Environment.cs.

◆ SystemPageSize

int System.Environment.SystemPageSize
staticget

Gets the number of bytes in the operating system's memory page.

Returns
The number of bytes in the system memory page.

Definition at line 434 of file Environment.cs.

◆ TickCount

int System.Environment.TickCount
staticget

Gets the number of milliseconds elapsed since the system started.

Returns
A 32-bit signed integer containing the amount of time in milliseconds that has passed since the last time the computer was started.

Definition at line 306 of file Environment.cs.

◆ UserDomainName

string System.Environment.UserDomainName
staticget

Gets the network domain name associated with the current user.

Returns
The network domain name associated with the current user.
Exceptions
T:System.PlatformNotSupportedExceptionThe operating system does not support retrieving the network domain name.
T:System.InvalidOperationExceptionThe network domain name cannot be retrieved.

Definition at line 618 of file Environment.cs.

◆ UserInteractive

bool System.Environment.UserInteractive
staticget

Gets a value indicating whether the current process is running in user interactive mode.

Returns
true if the current process is running in user interactive mode; otherwise, false.

Definition at line 594 of file Environment.cs.

◆ UserName

string System.Environment.UserName
staticget

Gets the user name of the person who is currently logged on to the Windows operating system.

Returns
The user name of the person who is logged on to Windows.

Definition at line 575 of file Environment.cs.

◆ WorkingSet

long System.Environment.WorkingSet
staticget

Gets the amount of physical memory mapped to the process context.

Returns
A 64-bit signed integer containing the number of bytes of physical memory mapped to the process context.

Definition at line 464 of file Environment.cs.


The documentation for this class was generated from the following file: