Skip to content

Commit 179c6ea

Browse files
Update docs for Environment.Version (dotnet#5196)
1 parent ffc2c49 commit 179c6ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

xml/System/Environment.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,15 +2499,17 @@ The following example creates environment variables for the <xref:System.Environ
24992499
<format type="text/markdown"><![CDATA[
25002500
25012501
## Remarks
2502-
For the .NET Framework Versions 4, 4.5, 4.5.1, and 4.5.2, the <xref:System.Environment.Version%2A?displayProperty=nameWithType> property returns a <xref:System.Version> object whose string representation has the form `4.0.30319.xxxxx`. For the .NET Framework 4.6 and later versions, it has the form `4.0.30319.42000`.
2502+
For .NET Core 3.x and .NET 5+, the <xref:System.Environment.Version%2A?displayProperty=nameWithType> property returns the .NET runtime version number.
2503+
2504+
For the .NET Framework Versions 4, 4.5, 4.5.1, and 4.5.2, the <xref:System.Environment.Version%2A?displayProperty=nameWithType> property returns a <xref:System.Version> object whose string representation has the form `4.0.30319.xxxxx`. For the .NET Framework 4.6 and later versions, and .NET Core versions before 3.0, it has the form `4.0.30319.42000`.
25032505
25042506
> [!WARNING]
25052507
> For the .NET Framework 4.5 and later, we do not recommend using the <xref:System.Environment.Version%2A> property to detect the version of the runtime; instead, you can determine the version of the common language runtime by querying the registry. For more information, see [How to: Determine Which .NET Framework Versions Are Installed](/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed).
25062508
25072509
For more information about the version of the common language runtime that is installed with each version of the .NET Framework, see [Versions and Dependencies](/dotnet/framework/migration-guide/versions-and-dependencies).
25082510
25092511
## Examples
2510-
The following example displays the version of the common language runtime. (The version is omitted from the example output for security reasons.)
2512+
The following example displays the version of the common language runtime.
25112513
25122514
[!code-cpp[Environment.Version#1](~/samples/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp#1)]
25132515
[!code-csharp[Environment.Version#1](~/samples/snippets/csharp/VS_Snippets_CLR/Environment.Version/CS/version.cs#1)]

0 commit comments

Comments
 (0)