ComputerInfo.AvailablePhysicalMemory and ComputerInfo.TotalPhysicalMemory.
But you still need to actually allocate the available memory using Marshal.AllocHGlobal or something similar. You cannot simply write to an address in memory as it might not even exist in your current processes address space.