CpuCollection-Klasse

The CpuCollection class represents a collection of Cpu objects that represent all the CPUs that are defined on an instance of SQL Server.

Vererbungshierarchie

System. . :: . .Object
  Microsoft.SqlServer.Management.Smo..::..CpuCollection

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

'Declaration
Public NotInheritable Class CpuCollection _
    Implements ICollection, IEnumerable
'Usage
Dim instance As CpuCollection
public sealed class CpuCollection : ICollection, 
    IEnumerable
public ref class CpuCollection sealed : ICollection, 
    IEnumerable
[<SealedAttribute>]
type CpuCollection =  
    class
        interface ICollection
        interface IEnumerable
    end
public final class CpuCollection implements ICollection, IEnumerable

Der CpuCollection-Typ macht folgende Elemente verfügbar.

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft AffitinizedCPUs Gets an affinitized Cpu list.
Öffentliche Eigenschaft Count Gets the number of Cpu entries in the collection.
Öffentliche Eigenschaft IsSynchronized Gets a value that indicates whether the collection is synchronized with the instance of SQL Server.
Öffentliche Eigenschaft Item Gets a Cpu object from the collection.
Öffentliche Eigenschaft SyncRoot Gets the synchronization root of the CpuCollection object.

Zum Anfang

Methoden

  Name Beschreibung
Öffentliche Methode CopyTo(Array, Int32) Copies the collection of objects to a one-dimensional array beginning at the specified index value.
Öffentliche Methode CopyTo(array<Cpu> [] () [] [], Int32) Copies the collection of objects to a one-dimensional array beginning at the specified index value.
Öffentliche Methode Equals (Geerbt von Object.)
Geschützte Methode Finalize (Geerbt von Object.)
Öffentliche Methode GetByID Gets a Cpu object with the specified CPU ID from the collection.
Öffentliche Methode GetElementAt Gets a Cpu object from the specified position in the collection.
Öffentliche Methode GetEnumerator Gets a IEnumerator interface that can be used to iterate over the CpuCollection object.
Öffentliche Methode GetHashCode (Geerbt von Object.)
Öffentliche Methode GetType (Geerbt von Object.)
Geschützte Methode MemberwiseClone (Geerbt von Object.)
Öffentliche Methode SetAffinityToAll Sets the affinity mask for all CPUs on an instance of SQL Server.
Öffentliche Methode SetAffinityToRange(Int32, Int32, Boolean) Sets the affinity mask for the CPUs in the specified range.
Öffentliche Methode SetAffinityToRange(Int32, Int32, Boolean, Boolean) Sets the affinity mask for the CPUs in the specified range.
Öffentliche Methode ToString (Geerbt von Object.)

Zum Anfang

Hinweise

The methods Count,

IsSynchronized,

SyncRoot and

[T:Microsoft.SqlServer.Management.Smo.CpuCollection.CopyTo(T:System.Array,T:System.Int32)] are inherited from ICollection and IEnumerable.

Beispiele

The following example shows how to display the ID of each CPU on an instance of 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();
            //Display the ID of each CPU on the instance of SQL Server.
            foreach (Cpu cpu in dbServer.AffinityInfo.Cpus)
            {
                Console.WriteLine("Cpu ID = {0}", cpu.ID);
            }
        }
    }
}

Powershell

$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbServer.Refresh()

#Display the ID of each CPU on the instance of SQL Server.
Foreach ($cpu in $dbServer.AffinityInfo.Cpus)
{
   Write-Host "CPU ID =" $cpu.ID
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic)-Elemente dieses Typs sind Threadsicher. Für Instanzelemente wird die Threadsicherheit nicht gewährleistet.