Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that retrieves command-line arguments information, exit codes information, environment variable settings information, contents of the call stack information, and time since last system boot in milliseconds information. In this article, we can check which process is running in our system using the Is64BitProcess property of the Environment Class. This method is used to check whether the current process is the 64-bit process or not. If the current process is a 64-bit process then it will return true otherwise it will return false.
Syntax:
Environment.Is64BitProcess
Return Type: The return type of this property is boolean. It will return true if the process is a 64-bit process. Otherwise, return false.
Example 1:
In this example, we are running our code on a 64-bit machine.
C#
using System;
class GFG{
static public void Main()
{
bool process = false ;
process = Environment.Is64BitProcess;
if (process == true )
Console.WriteLine( "The current process is 64-bit process" );
else
Console.WriteLine( "The current process is not 64-bit process" );
}
}
|
Output:
The current process is 64-bit process
Example 2:
In this example, we are running the same code on a 32-bit machine and we get a different output because now the process is 32-bit.
C#
using System;
class GFG{
static public void Main()
{
bool process = false ;
process = Environment.Is64BitProcess;
if (process == true )
Console.WriteLine( "The current process is 64-bit process" );
else
Console.WriteLine( "The current process is not 64-bit process" );
}
}
|
Output:
The current process is not 64-bit process
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
01 Nov, 2021
Like Article
Save Article