C# 判断操作系统是专业版、家庭版、企业版、教育版(原创)
作者:C/S框架网  发布日期:2018-07-21 22:08:31
   C# 判断操作系统是专业版、家庭版、企业版、教育版(原创)



C# Code:

using System;
using System.Data;
using System.Linq;
using System.Management;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
   public partial class Form1 : Form
   {
      public Form1()
      {
         InitializeComponent();
      }
      
      private void Form1_Load(object sender, EventArgs e)
      {
         var name = (from x in new ManagementObjectSearcher(
         "SELECT Caption FROM Win32_OperatingSystem").Get().Cast<ManagementObject>()
         select x.GetPropertyValue("Caption")).FirstOrDefault();
         
         string str= name != null ? name.ToString() : "Unknown";
      }
   }
}


//来源:C/S框架网(www.csframework.com) QQ:23404761






贴图图片
上一篇 下一篇