Re: Properties vs. Fields

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



One example:
The private field member value is not changed until the property set method
is completed.

I get caught by this once in a while...

Schneider



"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.22031a6d159ba4db807@xxxxxxxxxxxxxxxxxxxxxxx
Mark Henry <mhenry@xxxxxxxxxxxxxxxxxxxxxx> wrote:
I've run into a strange problem that I'm having a difficult time
tracking down. I have no idea what's causing it, so this seemed as good
a place to ask as any...

<snip>

Basically, can anyone think of a scenario where accessing a field
through a property will cause different behavior then accessing the
field directly? Even if the field is readonly? And if anyone has Neo
experience, is this something specific to Neo (which wouldn't surprise
me in the least - I need to hunt down their mailing lists)?

Well, data binding may well treat them very differently...

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk


.