DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.14.0" />

 Shared<T>

public sealed class Shared<T> where T : struct
Represents container for value type.
using System; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace DotNext.Runtime.CompilerServices { [EditorBrowsable(EditorBrowsableState.Advanced)] [Obsolete("Use BoxedValue<T> data type instead")] public sealed class Shared<T> where T : struct { public T Value; public static implicit operator Shared<T>([In] [IsReadOnly] ref T? value) { if (!value.HasValue) return null; return new Shared<T> { Value = value.GetValueOrDefault() }; } public static implicit operator Shared<T>(T value) { return new Shared<T> { Value = value }; } [System.Runtime.CompilerServices.NullableContext(2)] public override string ToString() { return Value.ToString(); } } }