Provides a mechanism to run code on construction and disposal, irrespective of exception handling Use this, for example, to set up and tear down state required for a test – your constructionAction is called immediately upon construction and the using() pattern guarantees that your disposalAction is called at disposal, even if your test fails. This is the variant of AutoResetter where:
More...
|
| AutoResetter (Func< T > start, Action< T > end) |
| Constructs a new AutoResetter, runs the start Func and stores the result.
|
void | Dispose () |
Provides a mechanism to run code on construction and disposal, irrespective of exception handling Use this, for example, to set up and tear down state required for a test – your constructionAction is called immediately upon construction and the using() pattern guarantees that your disposalAction is called at disposal, even if your test fails. This is the variant of AutoResetter where:
- The start Func returns a value
- Upon disposal, the end action is called with the value from (1)
- Template Parameters
-
T | Type of value which is passed to the start and end actions |
◆ AutoResetter()
Constructs a new AutoResetter, runs the start Func and stores the result.
- Parameters
-
start | Code to run at construction |
end | Code to run at disposal; will receive the result provided from the start Func |
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/AutoResetterOfT.cs