ILNumerics - Technical Application Development
Assembly: ILNumerics.Core (in ILNumerics.Core.dll) Version: 5.5.0.0 (5.5.7503.3146)
IDisposable which resets the setting property to its original value when Dispose is called.
Here is how this function is to be used:
<code>using (Settings.Ensure(() => Settings.MaxNumberThreads, 1u)) {
//this part runs in single threaded mode
//
// ...
}
// here we continue with Settings.MaxNumberThreads set to the original value, before we had modified it.
</code>
Ensure the value for a specific (static) setting with robust rollback. This should be used in a 'using' directive.
[ILNumerics Core Module]
Namespace: ILNumerics
Assembly: ILNumerics.Core (in ILNumerics.Core.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax
Parameters
- p
- Type: System.Linq.ExpressionsExpressionFuncT
Lambda expression _reading_ the target property. - v
- Type: T
The value to be ensured for settings.
Type Parameters
- T
- Type of the settings value.
Return Value
Type: IDisposableIDisposable which resets the setting property to its original value when Dispose is called.
Remarks
- Enclose the instructions where a certain value for one of the ILNumerics settings is needed into an 'using' block.
- In the head of the 'using' the EnsureT(ExpressionFuncT, T) method is called with a lambda function wrapping the setting to control and the new value for it.
- During the execution of the instructions in the body of the 'using' block the property will have the value provided by v.
- Once the body of the 'using' block is left the value of the Settings property will be reset to its original value automatically.
[ILNumerics Core Module]
Examples
See Also