问题描述
我正在使用 Windows 10 10240 Univasal Windows 应用程序,当我使用 Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion 获取设备版本时,它返回一个字符串2814750438211605"而不是版本格式(major.minor.修订版.构建).谁能告诉我字符串2814750438211605"是什么意思?
I'm working windows 10 10240 Univasal windows app, when i use Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion to get deivce version, it return a string "2814750438211605" instead of a version format (major.minor.revision.build).Anyone can tell me what the string "2814750438211605" means?
推荐答案
Windows 10 操作系统版本值位于此字符串属性中:
Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion
The Windows 10 OS version value is located in this string property:
Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion
它返回类似2814750438211613"的字符串值.
要将这个长数字转换为可读格式,请使用:
It returns string value like "2814750438211613".
To convert this long number to readable format use this:
string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
ulong v = ulong.Parse(sv);
ulong v1 = (v & 0xFFFF000000000000L) >> 48;
ulong v2 = (v & 0x0000FFFF00000000L) >> 32;
ulong v3 = (v & 0x00000000FFFF0000L) >> 16;
ulong v4 = v & 0x000000000000FFFFL;
string version = $"{v1}.{v2}.{v3}.{v4}"; // == 10.0.10240.16413
这篇关于Windows 10 获取 DeviceFamilyVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!