VS2010's "Public Property <PropertyName> As <DataType> vs. Public var
Posted
by Velika2
on Stack Overflow
See other posts from Stack Overflow
or by Velika2
Published on 2010-05-01T06:07:25Z
Indexed on
2010/05/01
6:17 UTC
Read the original article
Hit count: 301
In VS2008, I used to type
Public Property <PropName> As <dataType>
and hit the Enter key and the IDE editor would automatically expand it out to a full blown property block.
Now, from what I understand, a new feature of 2010 is that the compiler automatically "expands" the short syntax above into the same IL code that you would get with the full property GET AND SET sub methods that were are accustomed to seeing before in the editor.
But functionality, how the heck is this any different than just having a Public class level variable? If the only diff is what it compiles to and if otehrwise there is no functional difference, isn't the new way less efficient than the old since it involves more code than just having a class level memory variable?
Public as
I thought that if you weren't going to have code behind your properties that they were essentially the same. I guess the diffrenece is that they just added the keyword "Property" but functionality, their is no diff, eh?
© Stack Overflow or respective owner