How to Find the Name of the Operating System in C# ?

In C#, the "OSVersion" property of the "Environment" class is used to find out what the operating system is.

Usage is as follows..

namespace ConsoleApplicationTest
{
    class Program {

        static void Main(string[] args) {

            string myOS = System.Environment.OSVersion.ToString();

            Console.WriteLine(myOS);
            Console.ReadLine();

        }
    }
}



You May Interest

C# Example of Sum of Even Numbers from 1 to 100

C# Finding the Path to the Windows Folder

C# Non-Restart Check If Application is Open

Splitting a String By Desired Character in C#

C# Getting Last Character of String