logoalt Hacker News

Improving C# Memory Safety

73 pointsby soheilprolast Thursday at 4:54 PM6 commentsview on HN

Comments

pjmlplast Thursday at 8:38 PM

Most likely a side effect related to Windows team finally giving some C# love, instead of COM and C++, given the comparisons between C# 16 with Rust and Swift in a few article sections.

show 1 reply
superjantoday at 12:12 PM

What you can do in C# today is convert any unsafe pointer to Span whenever you get your hands on it, and pass around slices. You can still drop down to ‘fixed’ when it turns out you need it for performance.

SideburnsOfDoomtoday at 2:24 PM

> The unsafe keyword is being redesigned

OK, I see a lot of C# code often and over a long time.

I see the "unsafe" keyword used approximately never.

I'm sure that this is useful for some cases. But not everyday things for most of us. If we did use it, it would be carefully isolated in a library for a specific purpose.

show 2 replies