public T ValueGets the guaranteed non-zero underlying value.
Exceptions
InvalidOperationException- Thrown if default-initialized.
All Types / Ferrous.Results
public readonly struct NonZero<T> : IEquatable<NonZero<T>>, IComparable<NonZero<T>> where T : struct, INumberBase<T>, IComparable<T>
A zero-allocation wrapper guaranteeing a non-zero numeric value (Rust's std::num::NonZero<T>).
TINumberBase<TSelf>.public T ValueGets the guaranteed non-zero underlying value.
InvalidOperationExceptionpublic static Option<NonZero<T>> TryCreate(T value)Creates a NonZero<T> if value is non-zero; otherwise Option<T>.None.
public bool Equals(NonZero<T> other)public override bool Equals(object? obj)public override int GetHashCode()public int CompareTo(NonZero<T> other)public override string ToString()