title: get total memory (ram) pc in c#
body: <p>hi edit this code but get error " Cannt apply indexing with [] to an expression of type "view_process.managmentobject"  for line 8</p>
  
  <p>and what is formul for get 30% my memory?</p>
  
  <pre><code>private static void DisplayTotalRam()
      {
          string Query = "SELECT MaxCapacity FROM Win32_PhysicalMemoryArray";
          ManagementObjectSearcher searcher = new ManagementObjectSearcher(Query);
          int amount = 0;
          foreach (ManagementObject memo in searcher.Get())
          {
              amount += Convert.ToInt32(Convert.ToInt64(memo["Capacity"]) / 1024 / 1024 / 1024);
  
          }
      }
  </code></pre>