By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,617 Members | 1,600 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,617 IT Pros & Developers. It's quick & easy.

What is the naming convention for a string builder object?

P: n/a
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

Jun 23 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You could look in:
http://msdn.microsoft.com/library/de...guidelines.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.
<rs***@stationeryhouse.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
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

Jun 23 '06 #2

P: n/a
Hi,

You can find a general guideline (and naming conventions) in the following
article:
http://msdn.microsoft.com/library/de...l=/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

"rs***@stationeryhouse.com" wrote:
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

Jun 23 '06 #3

P: n/a
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. :)
rs***@stationeryhouse.com wrote:
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

Jun 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.