Gets the default context for the specified thread.
Namespace:
Gallio.FrameworkAssembly: Gallio (in Gallio.dll) Version: 3.3.0.0 (3.3.610.0)
Syntax
| C# |
|---|
public static TestContext GetThreadDefaultContext( Thread thread ) |
| Visual Basic (Declaration) |
|---|
Public Shared Function GetThreadDefaultContext ( _ thread As Thread _ ) As TestContext |
Parameters
- thread
- Type: System.Threading..::.Thread
The thread.
Return Value
The default context.
Remarks
The default context for a thread is GlobalContext unless the thread's default context has been overridden with SetThreadDefaultContext(Thread, TestContext).
Changing the default context of a thread is useful for capturing existing threads created outside of a test into a particular context. Among other things, this ensures that side-effects of the thread, such as writing text to the console, are recorded as part of the step represented by the specified context.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentNullException | Thrown if thread is null. |
