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.
More...
|
| AutoResetter (Action constructionAction, Action disposalAction) |
| Constructs a new AutoResetter and immediately runs the constructionAction.
|
| AutoResetter (Action disposalAction) |
| Constructs a new AutoResetter with the disposal action set and no construction action.
|
void | Dispose () |
|
static AutoResetter | Create (Action onStart, Action onDisposed) |
| Convenience to create an AutoResetter without new or having to care about whether you're using the action or func variant.
|
static AutoResetter< T > | Create< T > (Func< T > onStart, Action< T > onDisposed) |
| Convenience to create an AutoResetter without new or having to care about whether you're using the action or func variant.
|
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.
◆ AutoResetter() [1/2]
PeanutButter.Utils.AutoResetter.AutoResetter |
( |
Action | constructionAction, |
|
|
Action | disposalAction ) |
Constructs a new AutoResetter and immediately runs the constructionAction.
- Parameters
-
constructionAction | Action to run at construction time |
disposalAction | Action to run at disposal time |
◆ AutoResetter() [2/2]
PeanutButter.Utils.AutoResetter.AutoResetter |
( |
Action | disposalAction | ) |
|
Constructs a new AutoResetter with the disposal action set and no construction action.
- Parameters
-
◆ Create()
AutoResetter PeanutButter.Utils.AutoResetter.Create |
( |
Action | onStart, |
|
|
Action | onDisposed ) |
|
static |
Convenience to create an AutoResetter without new or having to care about whether you're using the action or func variant.
- Parameters
-
- Returns
◆ Create< T >()
Convenience to create an AutoResetter without new or having to care about whether you're using the action or func variant.
- Parameters
-
- Returns
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/AutoResetter.cs