Environment.ProcessorCount Property
.NET Framework 3.0
Gets the number of processors on the current machine.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
The following code example demonstrates the ProcessorCount property.
// This example demonstrates the // Environment.ProcessorCount property. using System; class Sample { public static void Main() { Console.WriteLine("The number of processors " + "on this computer is {0}.", Environment.ProcessorCount); } } /* This example produces the following results: The number of processors on this computer is 1. */
// This example demonstrates the
// Environment.ProcessorCount property.
import System.*;
class Sample
{
public static void main(String[] args)
{
Console.WriteLine("The number of processors "
+ "on this computer is {0}.",
System.Convert.ToString(Environment.get_ProcessorCount()));
} //main
} //Sample
/*
This example produces the following results:
The number of processors on this computer is 1.
*/
- EnvironmentPermission for read access to the NUMBER_OF_PROCESSORS environment variable. Associated enumeration: Read
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.