Hacker News new | ask | show | jobs
by ArtifTh 1862 days ago
C# has GC by default, but you can do manual memory management in "unsafe" blocks
1 comments

You can also do manual memory management in safe code.

- value types

- stackalloc is safe since C# 7

- SafeHandles since C# 2.0

- IDispose interface

- IDispose like Dispose() since C# 8

- Marshal class since C# 1.0

- Span<>() classes since C# 7

Forgot to mention:

- static lambdas since C# 9

- native function pointers since C# 9