Microsoft wants safer C# without turning it into Rust

Microsoft wants safer C# without turning it into Rust

By Tim Anderson
Publication Date: 2026-05-26 16:50:00

DevOps

Unsafe bits get a warning label in planned low-level coding shake-up

.NET product manager Richard Lander has written a
lengthy
post
describing how the team intends to improve the memory
safety of C# by introducing a new model and redefining the existing unsafe
keyword, making the language more like Rust, though without giving up automatic
memory management.

“We envision a future where C# is among a set of
languages chosen and noted for the type- and memory-safety enforcement,”
said Lander. 

Many C# developers never use unsafe, but it has been
part of the language from its first release. “Writing unsafe code is like
writing C code within a C# program,” said an early book called The C#
Programming Language, written by its inventor Anders Hejlsberg and others. Examples
of where unsafe code is necessary include interop with the underlying operating
system, accessing memory-mapped devices, or implementing…