Cpu.ID 属性

Gets the ID of the CPU that is represented by this Cpu object.

命名空间:  Microsoft.SqlServer.Management.Smo
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
Public ReadOnly Property ID As Integer 
    Get
用法
Dim instance As Cpu 
Dim value As Integer 

value = instance.ID
public int ID { get; }
public:
property int ID {
    int get ();
}
member ID : int
function get ID () : int

属性值

类型:System.Int32
An Int value that is assigned to the CPU represented by this Cpu instance.

注释

The ID member is read-only.

示例

The following code example shows how to display the GroupID for each CPU on the local 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();
            foreach (Cpu cpu in dbServer.AffinityInfo.Cpus)
            {
                Console.WriteLine("CPU ID {0} is {1}.",
                    cpu.ID, cpu.GroupID);
            }
        }
    }
}

Powershell

$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbServer.Refresh()
Foreach ($cpu in $dbServer.AffinityInfo.Cpus)
{
   Write-Host "CPU ID:" $cpu.ID "is" $cpu.GroupID
}

请参阅

参考

Cpu 类

Microsoft.SqlServer.Management.Smo 命名空间