diff --git a/src/ComputeSharp/Graphics/Luid.cs b/src/ComputeSharp/Graphics/Luid.cs
index 7eccacb2..8fb7f31f 100644
--- a/src/ComputeSharp/Graphics/Luid.cs
+++ b/src/ComputeSharp/Graphics/Luid.cs
@@ -3,19 +3,27 @@ using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using TerraFX.Interop.Windows;
+#pragma warning disable CS0649
+
namespace ComputeSharp;
///
/// A locally unique identifier for a graphics device.
///
public readonly struct Luid : IEquatable
+#if NET6_0_OR_GREATER
+ , ISpanFormattable
+#endif
{
- #pragma warning disable CS0649
-
+ ///
+ /// The low bits of the luid.
+ ///
private readonly uint lowPart;
- private readonly int highPart;
- #pragma warning restore
+ ///
+ /// The high bits of the luid.
+ ///
+ private readonly int highPart;
///
/// Creates a new instance from a raw value.
@@ -61,6 +69,21 @@ public readonly struct Luid : IEquatable
return (((long)this.highPart) << 32 | this.lowPart).ToString();
}
+#if NET6_0_OR_GREATER
+ ///
+ [Pure]
+ public string ToString(string? format, IFormatProvider? formatProvider)
+ {
+ return (((long)this.highPart) << 32 | this.lowPart).ToString(format, formatProvider);
+ }
+
+ ///
+ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider)
+ {
+ return (((long)this.highPart) << 32 | this.lowPart).TryFormat(destination, out charsWritten, format, provider);
+ }
+#endif
+
///
/// Check whether two values are equal.
///