title: Get Installed RAM Type
body: <p>I am trying to get the type of RAM thats installed on the PC. I was able to find a code example but it does not really work, it shows me always Unknown for DDR2.
  It also always returns 0 for DDR3.. words fine for SDRAM</p>
  
  <p>edit: should not that its suppose to work on XP.</p>
  
  <pre><code>    public string RAM_Type()
      {
  
          int type=0;
          var searcher = new ManagementObjectSearcher("Select * from Win32_PhysicalMemory");
          foreach (ManagementObject obj in searcher.Get())
          {
             type = Int32.Parse(obj.GetPropertyValue("MemoryType").ToString());
  
          }
  
          switch (type)
          {
              case 20:
                  return "DDR";
                  break;
              case 21:
                  return "DDR-2";
                  break;
              case 17:
                  return "SDRAM";
                  break;
              default:
                  if (type == 0 || type &gt; 22)
                      return "DDR-3";
                  else
                      return "Unknown";
          }
  
      }
  </code></pre>