Environment.ProcessorCount Environment.ProcessorCount Environment.ProcessorCount Environment.ProcessorCount Property

定義

現在のコンピューター上のプロセッサ数を取得します。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

プロパティ値

現在のコンピューター上のプロセッサ数を示す 32 ビット符号付き整数。The 32-bit signed integer that specifies the number of processors on the current machine. 既定値はありません。There is no default. 現在のコンピューターが複数のプロセッサ グループを持っている場合、このプロパティは共通言語ランタイム (CLR) で使用できる論理プロセッサの数を返します。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).

次の例で、ProcessorCountプロパティ。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.
Imports System

Class Sample
   Public Shared Sub Main()
      Console.WriteLine("The number of processors " & _
                        "on this computer is {0}.", _
                        Environment.ProcessorCount)
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'The number of processors on this computer is 1.
'

注釈

プロセッサ グループと論理プロセッサの詳細については、次を参照してください。プロセッサ グループします。For more information about processor groups and logical processors, see Processor Groups.

適用対象