Steven Giesel 11/6/2022

Mutable value types are evil! Sort of...

Read Original

This technical article examines the concept of mutable value types (structs) in C# and .NET. It explains why they are generally considered problematic due to copy semantics, using examples with DateTime and custom structs. The article also discusses why the .NET framework uses them in specific scenarios, such as in List<T>.Enumerator, primarily for performance optimization.

Mutable value types are evil! Sort of...

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week