Hi pals
I have three qestions
1-Is it possible to overload {} operator?
2-What is the benefit of using function objects other than functions?
3-How can i access CPU serial number and such a things?

Recommended Answers

All 3 Replies

1. Don't worry: {} is not an operator.
2. An object has a state so you can incapsulate essential context info for future calls.
3, No such thing as a CPU serial number (CPU ID) in modern Intel processors. To get other CPU parameters: see Intel Architecture Software Developer's manual (try to search in INET)...

3 arkm , i dont think you are right.

string cpuInfo = string.Empty;
            ManagementClass mc = new ManagementClass("win32_processor");
            ManagementObjectCollection moc = mc.GetInstances();

            foreach (ManagementObject mo in moc)
            {
                if (cpuInfo == "")
                {
                    //Get only the first CPU's ID
                    cpuInfo = mo.Properties["processorID"].Value.ToString();
                    break;
                }
            }

With the source code above you can find the processors id .
Btw, dont forget to include "using System.Management;" .
And "such stuff" could be found there too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.