Re: Class member addressing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:u4o7xuwpFHA.1148@xxxxxxxxxxxxxxxxxxxxxxx
>I sort of disagree with the take in "this". this is implicit for members so
>one need not type it *except* when using an IDE with intellisense where
>typeing "this.som" is way easier than typeing
>"SomeLongMethodNameThatsEasyToMisspell". Having this. in a statement is not
>hard to read and adds no overhead for the compiler.

Try

som ctrl space

I must say I'm suprised at the number of developers who don't know this
extremely useful shortcut :-) I must use it, without exaggeration, 200 times
a day when coding.

> Even though it's discouraged by the style-police I wholeheartedly agree
> with the prefix of an underbar in private members because a program
> written in C# that doesn't make use of the underbar for private members
> and relies only on capitalization for the distinction between the member
> and the accessor property is a complete pig to translate to VB.

Plus it eliminates conflicts (and hence possible bugs) between variable
name. When naming a private variable or function parameter there is zero
chance it will conflict with a class variable. I believe the MS standard
used to have the underscore and at least some of the private variables in
the framework have it.

Michael


.



Relevant Pages

  • FDA Advisory Members Vote Despite COIs
    ... FDA Drug Advisory Members Usually Vote Despite Conflict of Interest ... Still, in the present study, even if all members with conflicts had ... meetings featured 1957 committee members and 990 voting consultants. ...
    (alt.support.mult-sclerosis)
  • Re: Accessing private member via subclass
    ... "Members are either declared in the type, ... A class inherits the members of its direct base class. ... all those private members are still present ...
    (comp.lang.java.programmer)
  • Re: Accessing private member via subclass
    ... "Members are either declared in the type, ... A class inherits the members of its direct base ... and static constructors of the base class. ... all those private members are still present ...
    (comp.lang.java.programmer)
  • Re: How to access private members of a base class
    ... private members, and so on, and so on... ... > I already use reflection, ... But I CANNOT obtain the PRIVATE members of the base ... >>> members of its base classes.(I already have the ReflectionPermission) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: php 5 classes: public, protected and private
    ... Private members can be accessed by members of the class only. ... Protected members can be accessed by members of the class or a derived ... In PHP these are private members. ...
    (comp.lang.php)