FromKeyedServicesAttribute.Key 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
綁定服務的鑰匙。
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 表示該鍵應從父範圍繼承。