检查Windows名称c#

use*_*626 4 c#

我将在c#中检查我的Windows操作系统名称(Windows 8 Pro)但是它出错了,出了什么问题?

    RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", true);
    string currentKey;
    currentKey = reg.GetValue("ProductName", true).ToString();

    textBox1.Text = currentKey;
Run Code Online (Sandbox Code Playgroud)

Mea*_*ing 5

您可以使用Environment.OSVersion.

编辑: 获取操作系统名称在此处:Stackoverflow OS友好名称