Environment.ProcessorCount Eigenschaft

Definition

Ruft die Anzahl von Prozessoren im aktuellen Computer ab.Gets the number of processors on the current machine.

public:
 static property int ProcessorCount { int get(); };
public static int ProcessorCount { get; }
member this.ProcessorCount : int
Public Shared ReadOnly Property ProcessorCount As Integer

Eigenschaftswert

Die 32-Bit-Ganzzahl mit Vorzeichen, die die Anzahl von Prozessoren im aktuellen Computer angibt.The 32-bit signed integer that specifies the number of processors on the current machine. Es gibt keinen Standardwert.There is no default. Wenn der aktuelle Computer mehrere Prozessorgruppen enthält, gibt diese Eigenschaft die Anzahl logischer Prozessoren zurück, die für die Common Language Runtime (CLR) verfügbar sind.If the current machine contains multiple processor groups, this property returns the number of logical processors that are available for use by the common language runtime (CLR).

Beispiele

Im folgenden Beispiel wird die ProcessorCount-Eigenschaft veranschaulicht.The following example demonstrates the ProcessorCount property.

// This example demonstrates the 
//     Environment.ProcessorCount property.
using namespace System;
int 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.
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.
Class Sample
   Public Shared Sub Main()
      Console.WriteLine("The number of processors " & _
                        "on this computer is {0}.", _
                        Environment.ProcessorCount)
   End Sub
End Class
'
'This example produces the following results:
'
'The number of processors on this computer is 1.
'

Hinweise

Weitere Informationen zu Prozessor Gruppen und logischen Prozessoren finden Sie unter Prozessor Gruppen.For more information about processor groups and logical processors, see Processor Groups.

Gilt für: