How do you detect the number of physical processors/cores in .net?
This actually varies quite a bit depending on the target platform. Stephbu's answer will work great on XP SP3 and newer.
If you are targeting older platforms, you may want to check out this article. I wrote it about half a year ago and in it I discuss several different ways to do this as well as the individual pros and cons of each method.
You may also want to check out this code project article if you are interested in differentiating shadow cores from hyperthreading from real ones.