namespace WinFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OperatingSystem os = Environment.OSVersion;
PlatformID pid = os.Platform;
switch (pid)
{
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
case PlatformID.WinCE:
textBox1.Text = "Windows operating system";
break;
case PlatformID.Unix:
textBox1.Text = "Unix operating system";
break;
default:
textBox1.Text = "Invalid identifier";
break;
}
}
}
}
/*
* run:
*
* Windows operating system
*
*/