Simple object for writing RAII-like scoped states (see example).
Inheritance Hierarchy
Stemmer.CvbScopedStateTState
Namespace: Stemmer.Cvb
Assembly: Stemmer.Cvb (in Stemmer.Cvb.dll) Version: 14.0.0.0
Syntax
Type Parameters
- TState
- Must be a value type.
The ScopedStateTState type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ScopedStateTState |
Ctor.
|
Methods
Name | Description | |
---|---|---|
Dispose |
Cleanup - restore the flag's original value.
| |
Equals | (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Examples
bool flag = false; ... using (ScopedState f(new Ref(flag), true)) { // in here, flag will be true } // upon leaving, flag will revert to false
See Also