In .NET Framework, to get the OS version you can use Environment.OSVersion with the Major and Minor values telling you the version of Windows (i.e 6.1 = Windows 7, 10.0 = Windows 10). Even though Windows 11 has been released (dev and beta channels) for over a month now, the documentation has not been updated to mention how to detect Windows 11.
For Windows API, GetVersion has been deprecated forever and even the version helper APIs only go up to IsWindows10OrGreater. Is there a simple check to figure out the major Windows version, in particular Windows 11? Someone had a similar question but for Delphi (How to detect Windows 11 using Delphi 10.3.3) and the accepted answer was all hacks. Why the hell is it so difficult for Microsoft to provide a simple API to just return the current system version? GetVersion should never have been deprecated.