Friday 29 June 2012

.Net Tips : Identify whether the current operating system is a 64-bit operating system in .Net Framework 4

You can determine that the current operating system is 64 bit OS or not.
In .NET Framework 4 there is one function Is64BitOperatingSystem  is available to check that  current operating system is a 64-bit operating system.
This function available in Environment class of System namespace.
This function return true if OS is 64 bit else return false.

Here is example :
This example is in both C# .Net Programming and VB.Net Programming.

C# Example :
        if (System.Environment.Is64BitOperatingSystem == true)
        {
            Response.Write("This is 64 Bit Operating System.");
        }
        else
        {
            Response.Write("This is not 64 Bit Operating System.");
        }

VB.net Example :
        If System.Environment.Is64BitOperatingSystem = True Then
            Response.Write("This is 64 Bit Operating System.")
        Else
            Response.Write("This is not 64 Bit Operating System.")
        End If

This type of C# Tips is very useful in day to day programming life.

Note : Give Us your valuable feedback in comments. Give your suggestions in this article so we can update our articles accordingly that.



3 comments:

  1. this is very useful. i did not know that it is so easy in .Net 4.0 to find OS is 64 bit or not.
    can you also tell me how to detect processor is 64 bit or not?

    Also looking forward more tips of .Net 4 which overcome issues faced in earlier version of .Net.

    ReplyDelete
  2. Hi Shashank,
    I am keep finding new features of .Net 4.0 . As I get new features I will upload on this .Net Blog.

    ReplyDelete
  3. Excellent Blog, I appreciate your hard work , It is useful
    .NET Online Course Hyderabad

    ReplyDelete