語言

FakeLogRecord.StructuredState 屬性

定義

取得呼叫者在建立日誌記錄時所提供的不透明狀態,作為唯讀清單。

public:
 property System::Collections::Generic::IReadOnlyList<System::Collections::Generic::KeyValuePair<System::String ^, System::String ^>> ^ StructuredState { System::Collections::Generic::IReadOnlyList<System::Collections::Generic::KeyValuePair<System::String ^, System::String ^>> ^ get(); };
public System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<string,string?>>? StructuredState { get; }
member this.StructuredState : System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<string, string>>
Public ReadOnly Property StructuredState As IReadOnlyList(Of KeyValuePair(Of String, String))

屬性值

例外狀況

狀態物件與支援的日誌模型不相容,且非唯讀清單。

備註

使用程式碼產生器日誌模型進行日誌記錄時,你提供給日誌方法的參數會被打包成單一狀態物件,並交付給 Log<TState>(LogLevel, EventId, TState, Exception, Func<TState,Exception,String>) 該方法。 此狀態可以一組名稱/值對的編碼方式取得,並以唯讀清單形式編碼。

此屬性回傳的物件與 State 回傳的物件相同,只是被鑄造成唯讀清單。

適用於