使用System.Environment类获取当前运行操作系统版本信息,直接上实现方法:
/// <summary>
/// 执行获取当前运行的操作系统版本。
/// </summary>
/// <returns><see cref="Platform"/> 的值之一,他表示当前运行的操作系统版本。</returns>
private static Platform GetCurrentPlatform()
{
OperatingSystem os = Environment.OSVersion;
Platform pt;
switch (os.Platform)
{
case (PlatformID.Win32Windows): // Win95, Win98 or Me
switch (os.Version.Minor)
{
case (0): // 95
pt = Platform.Windows95;
break;
case (10): // 98
if (os.Version.Revision.ToString() == "2222A")
pt = Platform.Windows982ndEdition;
else
pt = Platform.Windows98;
break;
case (90): // winme
pt = Platform.WindowsME;
break;
default: // Unknown

最低0.47元/天 解锁文章
415

被折叠的 条评论
为什么被折叠?



