SoFunction
Updated on 2025-03-07

A detailed summary of C# judging operating system types


//C# determines whether the operating system is Windows 98
public static bool IsWindows98
{
    get
    {
        return ( == PlatformID.Win32Windows) && ( == 10) && (() != "2222A");
    }
}
//C# determines whether the operating system is Windows 98 second edition
public static bool IsWindows98Second
{
    get
    {
        return ( == PlatformID.Win32Windows) && ( == 10) && (() == "2222A");
    }
}
//C# determines whether the operating system is Windows 2000
public static bool IsWindows2000
{
    get
    {
        return ( == PlatformID.Win32NT) && ( == 5) && ( == 0);
    }
}
//C# determines whether the operating system is Windows XP
public static bool IsWindowsXP {
    get {
        return ( == PlatformID.Win32NT) && ( == 5) && ( == 1);
    }
}
//C# determines whether the operating system is Windows 2003
public static bool IsWindows2003
{
    get
    {
        return ( == PlatformID.Win32NT) && ( == 5) && ( == 2);
    }
}
//C# determines whether the operating system is Windows Vista
public static bool IsWindowsVista
{
    get
    {
        return ( == PlatformID.Win32NT) && ( == 6) && ( == 0);
    }
}
//C# determines whether the operating system is Windows 7
public static bool IsWindows7
{
    get
    {
        return ( == PlatformID.Win32NT) && ( == 6) && ( == 1);
    }
}
//C# determines whether the operating system is Unix
public static bool IsUnix
{
    get
    {
        return == ;
    }
}