ThreadLocal<T>
E697522
ThreadLocal<T> is a .NET generic class that provides thread-local storage, allowing each thread to have its own independently initialized value of a given type.
Statements (46)
| Predicate | Object |
|---|---|
| instanceOf |
.NET generic class
ⓘ
thread-local storage abstraction ⓘ |
| behavior |
Values enumerates values from all threads that have created them
ⓘ
each thread sees its own Value instance ⓘ |
| category |
concurrency utility
ⓘ
state management utility ⓘ |
| constraint | T can be any reference or value type ⓘ |
| definedIn | System.Threading namespace NERFINISHED ⓘ |
| designedFor |
multi-threaded applications
ⓘ
parallel programming scenarios ⓘ |
| documentation | https://learn.microsoft.com/dotnet/api/system.threading.threadlocal-1 ⓘ |
| ensures | each thread has its own value of type T ⓘ |
| hasConstructor |
ThreadLocal<T>()
ⓘ
ThreadLocal<T>(Func<T> valueFactory) ⓘ ThreadLocal<T>(Func<T> valueFactory, bool trackAllValues) ⓘ |
| hasMember |
IsDisposed (bool)
ⓘ
IsValueCreated (bool) ⓘ Value (get; set;) ⓘ Values (IEnumerable<T>) ⓘ |
| hasMethod |
Dispose()
ⓘ
ToString() ⓘ |
| hasProperty |
IsDisposed
ⓘ
IsValueCreated ⓘ Value ⓘ Values ⓘ |
| hasTypeParameter | T ⓘ |
| implementsInterface | IDisposable ⓘ |
| introducedIn | .NET Framework 4.0 NERFINISHED ⓘ |
| lifecycle | values are eligible for collection when thread ends or instance is disposed ⓘ |
| notThreadSafeFor | sharing Value across threads ⓘ |
| partOf | .NET Base Class Library NERFINISHED ⓘ |
| platform |
.NET 5+
ⓘ
.NET Core NERFINISHED ⓘ .NET Framework NERFINISHED ⓘ |
| provides | thread-local storage ⓘ |
| relatedTo |
AsyncLocal<T>
ⓘ
CallContext NERFINISHED ⓘ [ThreadStatic] attribute ⓘ |
| replacesPattern | manual ThreadStatic with initialization logic ⓘ |
| requires | proper disposal to release references early ⓘ |
| supports | Common Language Runtime (CLR) NERFINISHED ⓘ |
| threadAffinity | value is unique per thread ⓘ |
| usagePattern |
avoid shared mutable state between threads
ⓘ
store per-thread state without manual dictionaries ⓘ |
| valueInitialization |
can use value factory delegate
ⓘ
supports lazy initialization per thread ⓘ |
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.