Net-informations.com
SiteMap  | About    

C# - Operating System Information

The .NET Framework class library exposes features of the runtime and provides other high level services. The OperatingSystem Class provides a method to copy an instance of OperatingSystem, and a method to return a string representation of operating system information.

  System.Object
      System.OperatingSystem

The OperatingSystem class is not a general purpose class and you cannot derive a more inclusive type from the OperatingSystem class. If you need a type to contain other information about an operating system, create your own type, then include a field of type OperatingSystem and any additional fields, properties, or methods you require.

  OperatingSystem _os = null;
  _os = Environment.OSVersion;

The Environment Class has a property called OSVersion which returns an object of type OperatingSystem. The following C# program retrieves the current operating system information like version and platform identifier with the help of OperatingSystem Class and Environment Class.




using System;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			OperatingSystem _os = null;
			_os = Environment.OSVersion;

			MessageBox.Show (_os.VersionString.ToString());

		}
	}
}






net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.