語言

FromKeyedServicesAttribute.Key 屬性

定義

綁定服務的鑰匙。

public:
 property System::Object ^ Key { System::Object ^ get(); };
public object? Key { get; }
member this.Key : obj
Public ReadOnly Property Key As Object

屬性值

備註

值 null 表示沒有鍵,僅使用參數型別來解析服務。 這對於需要明確宣告參數應解析於無鍵服務的 DI 實作中非常有用。 也會使用一個 null 值與 LookupMode set 一起 InheritKey 表示該鍵應從父範圍繼承。

適用於