System memory is a bit complex and virtual memories make it more complex.
For the start you can use below code to get Installed Memory. For my laptop it is showing 16 GB which is correct.
var gcMemoryInfo = GC.GetGCMemoryInfo();
var installedMemory = gcMemoryInfo.TotalAvailableMemoryBytes;
var physicalMemory = (double)installedMemory / 1048576.0;
You can get further details from below
How to get memory available or used in C# - Stack Overflow[
^]
I was thinking of writing a bit detail over memory but then I found a great codeproject article that explains memory and their utilization in great length. You need to read the whole article with a cup of tea, will make your life easier.
Memory Limits in a .NET Process[
^]