Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Rikitav/Unified.Firmware/llms.txt
Use this file to discover all available pages before exploring further.
BootOptionIndex is a lightweight, immutable value type in the Unified.Firmware namespace that wraps a ushort index identifying a specific UEFI Boot#### NVRAM variable. Rather than passing raw ushort values through the API — which carry no semantic meaning on their own — BootOptionIndex makes intent explicit and provides a canonical string representation in the Boot#### format used by the firmware (e.g. index 3 becomes "Boot0003"). Because the struct defines implicit conversions both to and from ushort, you can pass a numeric literal anywhere a BootOptionIndex is expected without any explicit cast.
Namespace
Constructor
The zero-based 16-bit unsigned integer index of the target
Boot#### NVRAM variable. Valid range: 0x0000–0xFFFF.Interfaces Implemented
| Interface | Purpose |
|---|---|
IEquatable<BootOptionIndex> | Value equality against another BootOptionIndex. |
IEquatable<ushort> | Value equality against a raw ushort. |
IComparable<BootOptionIndex> | Ordering against another BootOptionIndex. |
IComparable<ushort> | Ordering against a raw ushort. |
Methods
ToString
Boot#### string representation of the index. The format string is $"Boot{_index:X4}" — the Boot prefix followed by the index value formatted as exactly four uppercase hexadecimal digits with leading zeros.
Returns: string — for example, index 3 → "Boot0003", index 255 → "Boot00FF", index 4096 → "Boot1000".
Equals
ushort value for equality.
The value to compare against.
bool — true if the underlying index values are equal.
CompareTo
ushort values using standard numeric ordering.
Returns: int — negative if this instance is less than other, zero if equal, positive if greater.
GetHashCode
ushort value. Safe to use as a dictionary key.
Operators
| Operator | Signature | Description |
|---|---|---|
== | BootOptionIndex == BootOptionIndex | true when both wrapped indices are equal. |
!= | BootOptionIndex != BootOptionIndex | true when the wrapped indices differ. |
Implicit Conversions
BootOptionIndex defines three implicit conversions so that you can use it interchangeably with ushort literals or string variables anywhere the API expects it.
| Conversion | Direction | Notes |
|---|---|---|
ushort → BootOptionIndex | Widening | Lets you pass a ushort literal (e.g. 0x0003) wherever a BootOptionIndex is required, with no explicit cast. |
BootOptionIndex → ushort | Narrowing | Extracts the raw index value. |
BootOptionIndex → string | — | Calls ToString(), producing "Boot####" with four uppercase hex digits. |
Usage Patterns
Passing a literal index
Becauseushort implicitly converts to BootOptionIndex, you can pass a hex literal directly to any FirmwareBootService method:
Working with BootOrder
FirmwareBootService.LoadOrder returns a BootOptionIndex[]. Iterate or index into it directly:
Printing the formatted name
The implicitstring conversion and ToString() both produce "Boot####" with four uppercase hex digits:
Comparing indices
BootOptionIndex is a readonly struct. All instances are value types and are copied by value. Assigning one to a variable or passing it to a method never aliases the original.