Microsoft brings Rust's approach to memory safety to C#
Microsoft is redesigning C#'s unsafe code model, moving it closer to Rust's implementation. As .NET product manager Richard Lander writes in the "Improving C# Memory Safety" blog post, the `unsafe` keyword becomes a caller-facing contract: unsafe operations will have to sit inside inner `unsafe { }` blocks, obligations will propagate through method signatures, and safety requirements will be documented in a `/// ` block. Violations will be compile errors rather than warnings. The feature is planned for C# 16, with a preview in .NET 11 and release in .NET 12; it will be opt-in at first, as nullable reference types once were. The goal is not to make unsafe code easier to write, but to make it easier to reason about and review.