Environment.Version Propriété
Définition
public:
static property Version ^ Version { Version ^ get(); };
public static Version Version { get; }
member this.Version : Version
Public Shared ReadOnly Property Version As Version
Valeur de propriété
Objet qui affiche la version du Common Language Runtime.An object that displays the version of the common language runtime.
Exemples
L’exemple suivant affiche la version du common language runtime.The following example displays the version of the common language runtime. (La version est omise de la sortie de l’exemple pour des raisons de sécurité.)(The version is omitted from the example output for security reasons.)
// Sample for the Environment::Version property
using namespace System;
int main()
{
Console::WriteLine();
Console::WriteLine( "Version: {0}", Environment::Version );
}
/*
This example produces the following results:
(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".)
Version: !---OMITTED---!
*/
// Sample for the Environment.Version property
using System;
class Sample
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine("Version: {0}", Environment.Version.ToString());
}
}
' Sample for the Environment.Version property
Class Sample
Public Shared Sub Main()
Console.WriteLine()
Console.WriteLine("Version: {0}", Environment.Version.ToString())
End Sub
End Class
Remarques
Pour .NET Framework versions 4, 4.5, 4.5.1 et 4.5.2, la propriété Environment.Version retourne un objet Version dont la représentation sous forme de chaîne se présente sous la forme 4.0.30319.xxxxx
.For the .NET Framework Versions 4, 4.5, 4.5.1, and 4.5.2, the Environment.Version property returns a Version object whose string representation has the form 4.0.30319.xxxxx
. Pour les .NET Framework 4,6 et versions ultérieures, la forme est 4.0.30319.42000
.For the .NET Framework 4.6 and later versions, it has the form 4.0.30319.42000
.
Avertissement
Pour les .NET Framework 4.5.NET Framework 4.5 et versions ultérieures, nous vous déconseillons d’utiliser la propriété Version pour détecter la version du Runtime ; au lieu de cela, vous pouvez déterminer la version de la common language runtime en interrogeant le registre.For the .NET Framework 4.5.NET Framework 4.5 and later, we do not recommend using the Version property to detect the version of the runtime; instead, you can determine the version of the common language runtime by querying the registry. Pour plus d’informations, consultez Guide pratique pour pour déterminer les versions du .NET Framework installées.For more information, see How to: Determine Which .NET Framework Versions Are Installed.
Pour plus d’informations sur la version de la common language runtime installée avec chaque version du .NET Framework, consultez versions et dépendances.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.