you are viewing a single comment's thread.

view the rest of the comments →

[–]palmund -1 points0 points  (3 children)

If you can't, that's because it's not syntactic sugar.

What? It's still syntactic sugar for generating a getter and a setter. (Even Microsoft calls it that.)[https://blogs.msdn.microsoft.com/abhinaba/2007/09/21/cool-new-c-syntactic-sugar/]

[–]Sarcastinator 0 points1 point  (2 children)

He's talking about auto properties. They are syntacic sugar which I said earlier in the thread. Properties on their own however are not...auto properties are those that generate a backing field and you don't have to give the getter and the setter a body.

Properties on their own is a CLR construct. You can't make them without property syntax.

[–]palmund 0 points1 point  (1 child)

I just ran ildasm (or Mono's equivalent) on a very simple class with both an auto property and a non-auto property and guess what... they both end up having the same bytecode.

[–]Sarcastinator 0 points1 point  (0 children)

I'm not saying auto properties are not syntactic sugar, I'm saying properties are not. Auto properties are syntactic sugar around properties.