问题描述
我想知道PC有哪个Windows版本.. C# Framework 3.5
I want to know which Windows version the PC has.. in C# Framework 3.5
我尝试过使用
OperatingSystem os = Environment.OSVersion;
OperatingSystem os = Environment.OSVersion;
版本ver = os.Version;
Version ver = os.Version;
但结果是
平台:WIN32NT
版本 6.2.9200
version 6.2.9200
次要版本:2
主要版本:6
问题是我有Windows 8 Pro"...
The problem is that I have "Windows 8 Pro"...
我怎样才能检测到它?
谢谢
推荐答案
您必须自己将版本号与适当的字符串值匹配.
You will have to match version numbers with the appropriate string value yourself.
以下是最新的 Windows 操作系统及其相应版本号的列表:
Here is a list of the most recent Windows OS and their corresponding version number:
- Windows Server 2016 &2019 - 10.0*
- Windows 10 - 10.0*
- Windows 8.1 - 6.3*
- Windows Server 2012 R2 - 6.3*
- Windows 8 - 6.2
- Windows Server 2012 - 6.2
- Windows 7 - 6.1
- Windows Server 2008 R2 - 6.1
- Windows Server 2008 - 6.0
- Windows Vista - 6.0
- Windows Server 2003 R2 - 5.2
- Windows Server 2003 - 5.2
- Windows XP 64 位版本 - 5.2
- Windows XP - 5.1
- Windows 2000 - 5.0
*对于已为 Windows 8.1 或 10 显示的应用程序.未为 8.1/10 显示的应用程序将返回 Windows 8 操作系统版本值 (6.2).
*For applications that have been manifested for Windows 8.1 or 10. Applications not manifested for 8.1 / 10 will return the Windows 8 OS version value (6.2).
这里是源.
另外,来自同一来源:
识别当前操作系统通常不是最好的方法以确定是否存在特定的操作系统功能.这是因为操作系统可能添加了新功能在可再发行的 DLL 中.而不是使用版本 API 助手确定操作系统平台或版本的函数编号,测试功能本身是否存在.
Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using the Version API Helper functions to determine the operating system platform or version number, test for the presence of the feature itself.
这篇关于c#中的Windows版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!