Gets the major version of the operating system. : Version « Development Class « C# / C Sharp






Gets the major version of the operating system.

        
//-----------------------------------------------------------------------
// <copyright file="Utility.cs" company="ParanoidMike">
//     Copyright (c) ParanoidMike. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace ParanoidMike
{
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    using Microsoft.Win32;

    /// <summary>
    /// Reusable functions for many uses.
    /// </summary>
    public static class Utility
    {
        /// <summary>
        /// Gets the major version of the operating system.
        /// </summary>
        public static int OSVersion
        {
            get
            {
                OperatingSystem os = Environment.OSVersion;

                return os.Version.Major;
            }
        }

    }
}

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.A version representing '2.0' does not equal a version representing '2.0.0.0'.
2.A Simple class used to keep track of package version.
3.Determines if the current version of windows is valid (Vista, 7, Server 2008)