Re: Private variables question



Phill Harvey-Smith wrote:

Hi,

This is more from a mater of interest than any technical reason, but
there seems to be a lot of code around where the private variables
are called FSomething e.g.

TYPE TSomeType=class(object)
PRIVATE
FLocalVar : INTEGER;
PUBLIC
PROPERTY LocalVar : INTEGER READ FLocalVar;
END;

What I guess i'm asking is why prefix it with 'F'

F stands for Field, which is Pascal/Delphi parlance for a data member
of a class or record. The T in TSomeType stands for Type.

I guess F was originally used to distinguish the backing data member
from the property. I.e. a property with the name Status would often
have a backing data member with the name FStatus. I also guess that
this was convenient to recognize private members, so later on, the
principle of naming private fields starting with an F was used for all
private fields.
--
Rudy Velthuis [TeamB] http://www.teamb.com

"We totally deny the allegations, and we are trying to identify
the allegators."
.



Relevant Pages

  • Re: camelCase
    ... When naming private fields the C# guidelines say to use camel casing ... public class SomeObject ... Fortunately, private members are private, so no compiler or client will care ...
    (microsoft.public.dotnet.languages.csharp)
  • Structural question regarding scope of variables
    ... Private Fields ... Private Instance Methods ... different connection strings, based on where the data will need to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Assigning "this"
    ... Define a private inner-class to hold all of your private fields (I ... Suppose I have two functions called DoubleSizes() and Double. ...
    (microsoft.public.dotnet.languages.csharp)
  • private field and public property naming conventions
    ... Has anyone found any naming convention guidelines for private fields ... public string MyVariable ... Public Property MyVariable() As String ...
    (microsoft.public.dotnet.framework)
  • Re: Enabling Access to Private Fields
    ... They should still be private to everything ... > access private fields on classes in the assembly that's performing the ... > dynamic compilation. ...
    (microsoft.public.dotnet.security)