You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System/Environment.xml
+8-10Lines changed: 8 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -2014,15 +2014,14 @@ If the executable is renamed or deleted before this property is first accessed,
2014
2014
2015
2015
On Unix-like systems, calls to the <xref:System.Environment.SetEnvironmentVariable%28System.String%2CSystem.String%29> method have no effect on any native libraries that are, or will be, loaded. (Conversely, in-process environment modifications made by native libraries aren't seen by managed callers.)
2016
2016
2017
-
If the `value` argument is not empty (see the discussion of deleting an environment variable later in this section for the definition of an empty value) and the environment variable named by the `variable` parameter does not exist, the environment variable is created and assigned the contents of `value`. If it does exist, its value is modified. Because the environment variable is defined in the environment block of the current process only, it does not persist after the process has ended.
2017
+
If the `value` argument is not `null` and the environment variable named by the `variable` parameter doesn't exist, the environment variable is created and assigned the contents of `value`. If it does exist, its value is modified. Because the environment variable is defined in the environment block of the current process only, it does not persist after the process has ended.
2018
2018
2019
2019
If `variable` contains a non-initial hexadecimal zero character, the characters before the zero character are considered the environment variable name and all subsequent characters are ignored.
2020
2020
2021
2021
If `value` contains a non-initial hexadecimal zero character, the characters before the zero character are assigned to the environment variable and all subsequent characters are ignored.
2022
2022
2023
-
If `value` is empty and the environment variable named by `variable` exists, the environment variable is deleted. If `variable` does not exist, no error occurs even though the operation cannot be performed. `value` is considered empty under any of the following conditions:
2023
+
If `value` is `null` (or empty in versions prior to .NET 9) and the environment variable named by `variable` exists, the environment variable is deleted. If `variable` doesn't exist, no error occurs even though the operation cannot be performed. `value` is considered empty under any of the following conditions:
2024
2024
2025
-
- It is `null`.
2026
2025
- It is <xref:System.String.Empty?displayProperty=nameWithType>.
2027
2026
- It consists of a single character whose value is U+0000.
2028
2027
@@ -2126,19 +2125,18 @@ On Unix-like systems, calls to the <xref:System.Environment.SetEnvironmentVariab
2126
2125
2127
2126
On Unix-like systems, calls to the <xref:System.Environment.SetEnvironmentVariable%28System.String%2CSystem.String%2CSystem.EnvironmentVariableTarget%29> method with a value of <xref:System.EnvironmentVariableTarget.Process?displayProperty=nameWithType> have no effect on any native libraries that are, or will be, loaded. (Conversely, in-process environment modifications made by native libraries aren't seen by managed callers.)
2128
2127
2129
-
If the `value` argument is not empty (see the discussion of deleting an environment variable later in this section for the definition of an empty value) and the environment variable named by the `variable` argument does not exist, the environment variable is created and assigned the contents of `value`. If it does exist, its value is modified.
2128
+
If the `value` argument is not `null` and the environment variable named by the `variable` argument doesn't exist, the environment variable is created and assigned the contents of `value`. If it does exist, its value is modified.
2130
2129
2131
2130
If `variable` contains a non-initial hexadecimal zero character, the characters before the zero character are considered the environment variable name and all subsequent characters are ignored.
2132
2131
2133
2132
If `value` contains a non-initial hexadecimal zero character, the characters before the zero character are assigned to the environment variable and all subsequent characters are ignored.
2134
2133
2135
-
If `value` is empty and the environment variable named by `variable` exists, the environment variable is deleted. `value` is considered empty under any of the following conditions:
2134
+
If `value` is `null` (or empty in versions prior to .NET 9) and the environment variable named by `variable` exists, the environment variable is deleted. `value` is considered empty under any of the following conditions:
2136
2135
2137
-
- It is `null`.
2138
-
- It is <xref:System.String.Empty?displayProperty=nameWithType>.
2139
-
- It consists of a single character whose value is U+0000.
2136
+
- It is <xref:System.String.Empty?displayProperty=nameWithType>.
2137
+
- It consists of a single character whose value is U+0000.
2140
2138
2141
-
If `variable` does not exist, no error occurs although the operation cannot be performed. Be careful when `target` is <xref:System.EnvironmentVariableTarget.Machine>, because you can accidentally delete an environment variable that affects your entire local machine, not just the current process or user.
2139
+
If `variable` doesn't exist, no error occurs although the operation can't be performed. Be careful when `target` is <xref:System.EnvironmentVariableTarget.Machine>, because you can accidentally delete an environment variable that affects your entire local machine, not just the current process or user.
2142
2140
2143
2141
### EnvironmentVariableTarget.Machine and EnvironmentVariableTarget.User on Windows systems
2144
2142
@@ -2562,7 +2560,7 @@ The following example creates environment variables for the <xref:System.Environ
2562
2560
<formattype="text/markdown"><![CDATA[
2563
2561
2564
2562
## Remarks
2565
-
The domain account credentials for a user are formatted as the user's domain name, the '\\' character, and user name. Use the <xref:System.Environment.UserDomainName%2A> property to obtain the user's domain name without the user name, and the <xref:System.Environment.UserName%2A> property to obtain the user name without the domain name. For example, if a user's domain name and user name are CORPORATENETWORK\john, the <xref:System.Environment.UserDomainName%2A> property returns "CORPORATENETWORK".
2563
+
The domain account credentials for a user are formatted as the user's domain name, the '\\' character, and user name. Use the <xref:System.Environment.UserDomainName%2A> property to obtain the user's domain name without the user name, and the <xref:System.Environment.UserName%2A> property to obtain the user name without the domain name. For example, if a user's domain name and user name are CORPORATENETWORK\john, the <xref:System.Environment.UserDomainName%2A> property returns "CORPORATENETWORK".
2566
2564
2567
2565
The <xref:System.Environment.UserDomainName%2A> property first attempts to get the domain name component of the Windows account name for the current user. If that attempt fails, this property attempts to get the domain name associated with the user name provided by the <xref:System.Environment.UserName%2A> property. If that attempt fails because the host computer is not joined to a domain, then the host computer name is returned.
0 commit comments