Re:Is .NET just miles ahead or am I delusional?
by ludston on Saturday April 13, 2024 @07:21PM
(#40027124)
I could probably give 20 different examples of this too. Not all of them would have identical compiler output, but the behaviour would be.
E.g. you could add
private int Foo { get; } = 4;
To the above example given that the behaviour is identical, although the compiled output should be different so I didn't to avoid any nit pickers.
https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQMwAJboMLoN7LpHoCW...
Yes, so you are right.
I don't get why in IL, the expression bodied member is different, though. Still, makes sense if you have learned C# starting from the most verbose form (3) then (2) was introduced, then (1).