Method Exchange
Exchange<T>(ref T, Func<T, T>)
Replaces a value with a new value generated by a factory function.
Declaration
public static T Exchange<T>(ref T location, Func<T, T> newValueFactory) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| T | location | The location to be exchanged. |
| Func<T, T> | newValueFactory | A function that generates a new value based on the original value. |
Returns
| Type | Description |
|---|---|
| T | The new value that was set at the specified location. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exchange<T>(ref T, out T, Func<T, T>)
Replaces a value with a new value generated by a factory function.
Declaration
public static T Exchange<T>(ref T location, out T originalValue, Func<T, T> newValueFactory) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| T | location | The location to be exchanged. |
| T | originalValue | When this method returns, contains the original value at the specified location. |
| Func<T, T> | newValueFactory | A function that generates a new value based on the original value. |
Returns
| Type | Description |
|---|---|
| T | The new value that was set at the specified location. |
Type Parameters
| Name | Description |
|---|---|
| T |