If you want to get information about the ram available on your system, you can use the Win32_OperatingSystem WMI class.
Creating a new Console Application project. Next, you need to import System.Management to your project by right-clicking on your project, then select Add References.

Openning your Program class, then modify your code as shown below.
static void Main(string[] args)
{
ObjectQuery objectQuery = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(objectQuery);
ManagementObjectCollection managementObjectCollection = managementObjectSearcher.Get();
foreach (ManagementObject managementObject in managementObjectCollection)
{
Console.WriteLine("Total Visible Memory: {0} KB", managementObject["TotalVisibleMemorySize"]);
Console.WriteLine("Free Physical Memory: {0} KB", managementObject["FreePhysicalMemory"]);
Console.WriteLine("Total Virtual Memory: {0} KB", managementObject["TotalVirtualMemorySize"]);
Console.WriteLine("Free Virtual Memory: {0} KB", managementObject["FreeVirtualMemory"]);
}
Console.ReadLine();
}
Press F5 to run your project.

TotalVisibleMemorySize: The amount of physical memory available for the operating system. This value does not necessarily indicate the actual physical memory capacity, but what is reported for the operating system is available to it.
FreePhysicalMemory: The amount of physical memory currently not in use and available.
TotalVirtualMemorySize: Capacity of virtual memory. Calculated by adding the total amount of RAM to the paging capacity, that is, adding the amount of memory in or aggregated by the computer system to the SizeStoredInPagingFiles property.
FreeVirtualMemory: Virtual memory capacity currently unused and available.