Watch Aspire live streamsDocsTry Aspire

AspireTerminalKey

Structreadonlynet10.0
📦 Aspire.Hosting v13.6.0
Represents one terminal keypress, optionally combined with modifiers, for AspireTerminal.SendKeyAsync.
namespace Aspire.Hosting.ApplicationModel;
public sealed readonly struct AspireTerminalKey
: System.IEquatable<Aspire.Hosting.ApplicationModel.AspireTerminalKey>
{
// ...
}
IEquatable<AspireTerminalKey>

Use a named key property and compose AspireTerminalKey.Ctrl, AspireTerminalKey.Shift, and AspireTerminalKey.Alt to add modifiers. Composition is order-independent, and applying the same modifier repeatedly has no additional effect. A default-initialized value is invalid and cannot be sent or passed to a modifier factory.

Letter keys produce lowercase letters without modifiers and uppercase letters with AspireTerminalKey.Shift. Digit and punctuation keys follow the US keyboard layout. Use AspireTerminal.SendTextAsync for arbitrary text or Unicode rather than composing keypresses.

These values describe terminal input, not physically held keys. Terminal protocols, platforms, and applications differ in how they interpret key combinations. Legacy terminal encoding cannot distinguish Ctrl+I from Tab, Ctrl+M from Enter, or Ctrl+Shift+letter from Ctrl+letter.

View all properties
View all methods
await terminal.SendKeyAsync(AspireTerminalKey.Shift(AspireTerminalKey.E));
await terminal.SendKeyAsync(AspireTerminalKey.Ctrl(AspireTerminalKey.Alt(AspireTerminalKey.Delete)));