Ehsan Ghanbari

Experience, DotNet, Solutions

How to get CPU Id by using C# with .Net classes

By using ManagementObjectSearcher class in System.Management; namespace you can get your hardware information such as CPU Id. take a look at this piece of code:


  static void Main(string[] args)
            var managementObjectSearcher = new ManagementObjectSearcher("SELECT ProcessorId FROM Win32_Processor");
            var oCollection = managementObjectSearcher.Get();
            foreach (ManagementObject item in oCollection)
                var myProcessor = (string)item["ProcessorId"];
                Console.WriteLine("Processor Id: {0}", myProcessor);


Have fun!


About Me

Ehsan Ghanbari

Hi! my name is Ehsan. I'm a developer, passionate technologist, and fan of clean code. I'm interested in enterprise and large-scale applications architecture and design patterns and I'm spending a lot of my time on architecture subject. Since 2008, I've been as a developer for companies and organizations and I've been focusing on Microsoft ecosystem all the time. During the&nb Read More

Post Tags
Pending Blog Posts
Strategic design
Factory Pattern
time out pattern in ajax
Selectors in Jquery
Peridic pattern
How to use PagedList In MVC
Redis as a cache server
Domain driven design VS model driven architecture
How to query over Icollection<> of a type with linq
What's the DDD-lite?
comments powered by Disqus