Właściwość CpuCollection.Count
Pobiera numer Cpu wpisów kolekcja.
Przestrzeń nazw: Microsoft.SqlServer.Management.Smo
Zestaw: Microsoft.SqlServer.Smo (w Microsoft.SqlServer.Smo.dll)
Składnia
'Deklaracja
Public ReadOnly Property Count As Integer
Get
'Użycie
Dim instance As CpuCollection
Dim value As Integer
value = instance.Count
public int Count { get; }
public:
virtual property int Count {
int get () sealed;
}
abstract Count : int
override Count : int
final function get Count () : int
Wartość właściwości
Typ: System.Int32
Zwraca liczbę Cpu wpisów kolekcja.Zwracany typ jest T:[System.int] wartość.
Implementacje
Przykłady
W poniższym przykładzie pokazano, jak ustalić całkowitą liczbę procesorów na wystąpienie SQL Server.
C#
using System;
using Microsoft.SqlServer.Management.Smo;
namespace samples
{
class Program
{
static void Main(string[] args)
{
Server dbServer = new Server("(local)");
dbServer.Refresh();
Console.WriteLine("Total CPUs: {0}",
dbServer.AffinityInfo.Cpus.Count);
}
}
}
PowerShell
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbServer.Refresh()
Foreach ($cpu in $dbServer.AffinityInfo.Cpus)
{
Write-Host "Total CPUs:" $dbServer.AffinityInfo.Cpus.Count
}