Re: C# coding guidelines: use "this." or not when referring to member fields/properties within the object?



"Dave" <none@xxxxxxxxxxx> wrote in message
news:%23uTFZ$XZGHA.3448@xxxxxxxxxxxxxxxxxxxxxxx
Also, while I'm thinking about it: should a class internally reference
properties by the property name or by the private variable that stores the
value? I've done both. I suppose the main thing is if the property does
more than just set the value of the private variable then the class code
should use the property name instead of the private variable.

You should do whatever is appropriate for each situation but favour the
private variable for sure. There is no point repeatedly calling a property
to do the same thing unless there is a good reason.

Michael


.



Relevant Pages

  • Re: Feed your stash
    ... stores today, with nothing in mind to actually buy, just browsing..... ... >A new reason to buy fabric - but now and ... >The post office website says that mail service to south Mississippi will be ... I really and truly can not outlive my stash. ...
    (rec.crafts.textiles.quilting)
  • Re: Bad News for Ron
    ... REAL bakeries that make REAL donuts here. ... that's not the only reason a lot of them closed. ... groceries, convenience stores, etc. - in effect, supplying their ...
    (alt.vacation.las-vegas)
  • Re: Amazon and the Re-release of Nadesico: Prince of Darkness
    ... Right Stuf and other online stores will ... FYE has been keeping titles on the shelf, ... of DVDs that the only reason it seems that they didn't have Prince of ... Darkness on their shelves anyway was because it went out of print. ...
    (rec.arts.anime.misc)
  • Re: A Heart Attack Waiting To Happen
    ... when I see Christmas decorations in a store out of season, ... second reason to turn around and leave. ... stores will stop doing this. ... Plenty, perhaps most, don't put up decorations until December, ...
    (rec.arts.sf.fandom)
  • Re: Microsoft - Still Copying Apple After All These Years
    ... >>> You didn't really expect michael the liar glasser to admit he was ... >> John's claim that MS is copying Apple is quite reasonable. ... Apparently, "opening stores" is what MS has copied from Apple, ... successful store" from Apple (or anyone else that has ever opened a ...
    (comp.sys.mac.advocacy)

Loading