AutoProperties, Structs and Constructors (C# Wishes Part 3)

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)”

Advertisements

ReadOnly Auto-Properties (C# Wishes Part 2)

I’ve been talking on this blog talking about things I’d love to see added to C# – things that I think would give a significant improvement in the language. And my 2nd item is a very simple one: Allow read-only auto-properties.

Let’s look at the problem first. Continue reading “ReadOnly Auto-Properties (C# Wishes Part 2)”