How to get the size of available system memory?

后端 未结 5 1031
遥遥无期
遥遥无期 2020-12-02 15:27

Is it possible to get the size of system available memory in C#.NET? if yes how?

5条回答
  •  悲&欢浪女
    2020-12-02 16:11

    This answer is based on Hans Passant's. The required property is AvailablePhysicalMemory actually. and it (and TotalPhysicalMemory and others) are instance variables, so it should be

    new ComputerInfo().AvailablePhysicalMemory
    

    It works in C#, but I wonder why this page says that for C#, "This language is not supported or no code example is available."

提交回复
热议问题