Of course, you know the rule, don’t you. If you want to define your own value types in .NET, make sure they are immutable. Don’t create mutable value types!
Unfortunately, today, I forgot that rule. And I paid the price in a couple of hours needless debugging. Continue reading “Mutable Structs are Evil. Yes. Really.”
I’m sure most of us have been there. You have some small data type to declare, which only really contains a couple of primitives and is clearly most appropriate to exist as a struct. You put a couple of values in it, and because you’re doing this quickly and you want your code to be simple, you use auto properties. For this kind of struct there’s (hopefully) no reason not to.
And in the best traditions of those cookery programmes you see on tv, here’s one that I prepared earlier: Continue reading “AutoProperties, Structs and Constructors (C# Wishes Part 3)”