What should be the C# equivalent of Rust's Box<> type?
The short answer is that there isn't an exactly-equivalent type.
Box is used to put a value on the heap.  There are several reasons why you would want to do that, but that's all it does.
In C#, reference types always point to a heap allocation.  "Boxing" is therefore pointless on reference types, as they are already effectively boxed.
C# value types are instead allocated directly, either on the stack or directly inside an object's heap allocation if used as a non-static class field.  You can box a C# value type by casting it to a compatible reference type: either object or an interface type implemented by the value type.
However, reference types in C# are not just boxed, they also have shared ownership as well as shared mutability and so C# reference types are closer to the Rust types that implement those behaviors, such as Rc<RefCell<T>> or Arc<Mutex<T>>, though there are still very relevant semantic differences between those types and C# reference types (Rc<_> can't be sent to other threads, Arc<Mutex<_>> has to be locked to access the inner value, both Rc and Arc can create reference cycles that could cause a memory leak, etc.).  Shared mutability in particular requires some kind of synchronization/atomicity to even pass the Rust compiler, where C# has no problem letting you create data races.

In other words, you need to look at why the value is boxed.

Is it to enable polymorphism on a set of heterogeneous values (Box<dyn _>)?  Just use C# interfaces.
Is it to enable a recursive structure?  Just use C# classes, which can self-recurse without issue.


I am translating Rust code into C#.
Rust has some type called Box<> which is said to be C++'s equivalent of smart pointers.
What should be the C# equivalent of Rust's Box<> type?
