ThreadLocal<T>.ToString 方法

定義

建立並傳回目前執行緒的這個執行個體的字串表示。Creates and returns a string representation of this instance for the current thread.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

傳回

ToString() 上呼叫 Value 的結果。The result of calling ToString() on the Value.

例外狀況

ThreadLocal<T> 執行個體已經過處置。The ThreadLocal<T> instance has been disposed.

目前執行緒的 Value 是 Null 參考 (在 Visual Basic 中為 Nothing)。The Value for the current thread is a null reference (Nothing in Visual Basic).

初始化函式會嘗試遞迴參考 ValueThe initialization function attempted to reference Value recursively.

沒有提供任何無參數的建構函式,也沒有提供任何値 Factory。No parameterless constructor is provided and no value factory is supplied.

備註

呼叫這個方法會強制初始化目前的執行緒,如同直接存取 Value 的情況。Calling this method forces initialization for the current thread, as is the case with accessing Value directly.

適用於

另請參閱