C# Program to Get the Memory Size For OS Page File using Environment Class
Last Updated :
24 Oct, 2021
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 will discuss how to find the memory size for the OS Page file. So we can find the memory size of the OS page file by using the SystemPageSize property. This property returns the number of bytes present in the operating system’s memory page.
Syntax:
Environment.SystemPageSize
Return Type: The return type of this property is an integer.
Example:
C#
using System;
class GFG{
static public void Main()
{
int result;
result = Environment.SystemPageSize;
Console.WriteLine( "The memory size for OS page file is " + result);
}
}
|
Output:
The memory size for OS page file is 4096
Example 2:
C#
using System;
class GFG{
static public void Main()
{
int Sum = 1 + 3;
Console.WriteLine( "Sum:" + Sum);
int res;
res = Environment.SystemPageSize;
Console.WriteLine( "The memory size for OS page file is " + res);
}
}
|
Output:
Sum:4
The memory size for OS page file is 4096
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...