如何在C#中获取当前内存页面大小

How to get current memory page size in C#

我需要在 C# 中确定内存页面大小而不使用“Kernel32.dll”

SYSTEM_INFO si;
GetSystemInfo(&si);

这非常重要,因为代码应该是跨平台的,我们不应该有特定于平台的代码。

是否有任何 .NET class 提供该数据?

尝试 Environment.SystemPageSize:

Gets the number of bytes in the operating system's memory page.

需要 .NET >= 4.0

评论里还写着:

In Windows, this value is the dwPageSize member in the SYSTEM_INFO structure.