ThreadLocal<T>.Value Propriedade

Definição

Obtém ou define o valor dessa instância para o thread atual.Gets or sets the value of this instance for the current thread.

public:
 property T Value { T get(); void set(T value); };
public T Value { get; set; }
member this.Value : 'T with get, set
Public Property Value As T

Valor da propriedade

T

Retorna uma instância do objeto que este ThreadLocal é responsável por inicializar.Returns an instance of the object that this ThreadLocal is responsible for initializing.

Exceções

A instância ThreadLocal<T> foi descartada.The ThreadLocal<T> instance has been disposed.

A função de inicialização tentou referenciar Value recursivamente.The initialization function attempted to reference Value recursively.

Nenhum construtor sem parâmetros é fornecido e nenhum alocador de valor é fornecido.No parameterless constructor is provided and no value factory is supplied.

Comentários

Se essa instância não tiver sido inicializada anteriormente para o thread atual, o acesso Value tentará inicializá-la.If this instance was not previously initialized for the current thread, accessing Value will attempt to initialize it. Se uma função de inicialização foi fornecida durante a construção, essa inicialização ocorrerá invocando a função para recuperar o valor inicial de Value .If an initialization function was supplied during the construction, that initialization will happen by invoking the function to retrieve the initial value for Value. Caso contrário, o valor padrão de T será usado.Otherwise, the default value of T will be used.

Aplica-se a

Confira também