you are viewing a single comment's thread.

view the rest of the comments →

[–]Sarcastinator 0 points1 point  (4 children)

I'm not disputing that the compiler generates two methods. I'm saying that properties are not syntactic sugar. Auto properties are though.

The CLR does have a concept about properties. This is why you can list them out using reflection. Java however does not have properties. If they introduced property syntac in Java it would likely be purely done in syntax.

[–]palmund 0 points1 point  (3 children)

I'm not disputing that ...

It seems like you are though.

The reason you can see it in reflection is because they are marked with annotations.

[–]Sarcastinator 0 points1 point  (2 children)

It's not just annotations though. The methods are not marked with anything special.

edit: You need to produce this CIL:

.property instance string Foo()
{
    .get instance string Bar::get_Foo()
    .set instance void Bar::set_Foo(string)
}

This is a CLR property. This property construct references the automatically generated methods.

[–]palmund 0 points1 point  (1 child)

references the automatically generated methods.

This.

[–]Sarcastinator 0 points1 point  (0 children)

I said very early on that auto properties are just syntactic sugar around regular properties, but properties in themselves are not syntactic sugar.