ManagementBindAttribute 類別

定義

ManagementBind 屬性指出,方法是用來傳回與特定索引鍵值相關聯之 WMI 類別的執行個體。

注意:WMI .NET 程式庫目前被視為最終狀態,針對影響這些程式庫的非安全性相關問題,不會提供進一步的開發、增強功能或更新。 MI API 應使用於所有新的開發。

public ref class ManagementBindAttribute sealed : System::Management::Instrumentation::ManagementNewInstanceAttribute
[System.AttributeUsage(System.AttributeTargets.Constructor | System.AttributeTargets.Method, AllowMultiple=false)]
public sealed class ManagementBindAttribute : System.Management.Instrumentation.ManagementNewInstanceAttribute
[<System.AttributeUsage(System.AttributeTargets.Constructor | System.AttributeTargets.Method, AllowMultiple=false)>]
type ManagementBindAttribute = class
    inherit ManagementNewInstanceAttribute
Public NotInheritable Class ManagementBindAttribute
Inherits ManagementNewInstanceAttribute
繼承
屬性

範例

下列範例示範如何使用ManagementBind屬性來標記類別的建構函式。

// Use the ManagementBind attribute to specify that this constructor  
// is used to attach a class instance to a specific WMI  
// instance. The constructor should set the values of the  
// key properties of the WMI instance.  
[ManagementBind]  
public ClassConstructor(int Id)  
{  
     // Set this class instance to a specific instance  
     // by assigning property values and   
     // giving unique values to the key properties.   
}  

備註

這個屬性會標示基礎結構用來執行 WMI 取得作業的方法。 方法必須採用對應 WMI 類別的索引鍵值作為參數,並傳回 WMI 類別的相關聯實例。

重要

方法參數的名稱和類型必須與 類別的索引鍵參數完全相同。 索引鍵參數是由 ManagementKeyAttribute 屬性識別。

方法必須將值指派給 類別的所有已檢測屬性。

當 WMI 提供者延伸模組基礎結構需要此系結功能時,它會先搜尋具有這個屬性的建構函式。 如果找不到任何專案,則會搜尋傳回 WMI 類別類型的靜態方法。

此屬性的目標必須是方法或靜態方法。

建構函式

ManagementBindAttribute()

初始化 ManagementBindAttribute 類別的新執行個體。 這是無參數建構函式。

屬性

Name

取得或設定管理屬性的名稱。

(繼承來源 ManagementMemberAttribute)
Schema

取得或設定值,以定義含有 ManagementEnumerator 屬性標記的方法所輸出的型別。

TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。

(繼承來源 Attribute)

方法

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

(繼承來源 Attribute)
GetHashCode()

傳回這個執行個體的雜湊碼。

(繼承來源 Attribute)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。

(繼承來源 Attribute)

適用於