Method WithValue
WithValue(object?)
Creates a new context with the specified value appended to the Values chain. The new value becomes the last element, making it the new Value.
public CommandContext WithValue(object? value)
Parameters
valueobjectThe value to append.
Returns
- CommandContext
A new CommandContext with the value appended to Values.
Remarks
The spread expression [..Values, value] copies the entire list on each call,
giving O(N²) total allocations for N appends. This is acceptable for typical UI hierarchies
(3–5 levels deep). If extreme depths are ever needed, consider an immutable linked list or builder.