How to Detect Windows Phone OS version using C#?

The Windows Phone SDK provides the Environment.OSVersion property which can be used to detect the version of the Operating System uses in Windows Phone (Windows Phone 8 / Windows Phone 7).

Below is a code snippet that demonstrates how to detect the Windows Phone OS Version using C#.

How to Detect Windows Phone OS version using C#?

var WindowsphoneACVersion = Environment.OSVersion.ToString();

MessageBox.Show(WindowsphoneACVersion);