How to Detect the Windows version in .NET?
How to Detect the Windows version in .NET?
Student
I am Utpal Vishwas from Uttar Pradesh. Have completed my B. Tech. course from MNNIT campus Prayagraj in 2022. I have good knowledge of computer networking.
Sure, here is how to detect Windows version in .NET:
C#
This code will first get the Windows version from the
Environmentobject. TheEnvironmentobject provides information about the environment that the code is running in.Next, the code will print the Windows version to the console. The
VersionStringproperty of theOSVersionclass returns a string that represents the Windows version.Here is an example of the output of this code:
This output shows that the computer is running Windows 10, version 20H2.
Here is a table summarizing the key properties of the
OSVersionclass: