Method Move
Move<T>(ref T)
Takes the value out of a variable, a field or an array element and leaves the default value behind, so that the value can be handed on without a copy: stored in a field, passed by value, returned or awaited later.
Declaration
public static T Move<T>(ref T value) where T : allows ref struct
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The location to take the value out of. It holds the default value of |
Returns
| Type | Description |
|---|---|
| T | The value that |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value. |
Remarks
A second use of the location hits a default value and not a second instance. A location that cannot be passed by reference, such as a using variable or a read-only field, cannot be moved from: something else still owns its value.