Windows Phone Developers

Friday, September 16, 2011

VB.NET / C# - How to Check if OS is 64-Bit or 32-Bit

The following snippet gives a hint :

        private void GetOSConfig()
        {
            string sProcess;
            if (Environment.Is64BitOperatingSystem  == true )
            {
                sProcess = "64 Bit";
            }
            {
                sProcess = "32 Bit";
            }
            Console.WriteLine("OS is {0}", sProcess  );
        } Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

3 comments:

  1. It is returning 32-bit though my OS is Win7-64 bit. Can someone help me

    ReplyDelete
  2. correction: you need to add the 'else' conditoion too:
    The following snippet gives a hint :

    private void GetOSConfig()
    {
    string sProcess;
    if (Environment.Is64BitOperatingSystem == true )
    {
    sProcess = "64 Bit";
    }
    else
    {
    sProcess = "32 Bit";
    }
    Console.WriteLine("OS is {0}", sProcess );
    }

    ReplyDelete
    Replies
    1. Its not worked in .net framework 3.5, missing 'Is64BitOperatingSystem' keyword.

      Delete

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005