namespace Myriad.Utils { public interface IOptional { object? GetValue(); } public readonly struct Optional: IOptional { public Optional(T value) { HasValue = true; Value = value; } public bool HasValue { get; } public object? GetValue() => Value; public T Value { get; } public static implicit operator Optional(T value) => new(value); public static Optional Some(T value) => new(value); public static Optional None() => default; } }