What is the naming convention for a string builder object?

  • Thread starter Thread starter rsine
  • Start date Start date
R

rsine

I have searched around a little and have yet to find a naming
convention for the string builder object. I really do not want to use
"str" since this is for string objects and thus could be confusing.
Also, I would like a good source on the naming conventions to be used
for other objects. It seems there are tons of sights with naming
conventions but none seem to contain a complete list for all the
objects in .Net. Is there such a listing?

-Thanks
 
You could look in:
http://msdn.microsoft.com/library/d...en-us/cpgenref/html/cpconnamingguidelines.asp

My understanding is that using prefixes like this are now frowned upon, so
you shouldn't need to use "str" or "int" or whatever else you have used in
the past.

Steve

P.S.
I use "sb" for string builder. It's a 'standard' only in my own mind, so
should not be taken to have meaning to anyone else. I'm gradually weaning
myself off prefixes, but having typed them for so many years, it's a
difficult urge to overcome.
 
Hi,

You can find a general guideline (and naming conventions) in the following
article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpgenref/html/cpconnetframeworkdesignguidelines.asp

Naming guidelines for local variables are not in that document, but
hungarian notation seems to be not recommend anymore. There are too many
objects in the base class library alone, that it would be impossible to give
them all a different meaningful prefix.

So, if your creating an SQL statement for example, you could name your
StringBuilder "sqlBuilder", for example.

Joris
 
If you want a prefix for that, it would simply be "obj".

There is really no need for hungarian notation in a strongly typed
language, and it's not possible to set up a useful set of prefixes for
all available classes in the framework. There would be so many prefixes
that they would not convey any information at all, as noone would be
able to learn them all.

One part of the naming convention in the framework is that names should
really mean something rather than being short. It's "StringBuilder", not
"strbld". It's "CreateSignificantWhitespace", not "crtwsp".

Try to follow the same philosophy when naming your variables.
"currentLine" says so much more than "cl".

There is auto-complete in the editor, so you only have to write the
entire name once. :)
 
Back
Top