Over the past several years I have been using the naming convention of FirstNameTxt
when I'm referring to a TextBox Control for a 'First Name' field. However, I've noticed the majority of other developers tend to use the naming convention txtFirstName
Which is the best convention to use? and why is it preferred over the other method?
I like using the Hungarian Notation - prepending with a 3-letter abbrev - if for any other reason, all the textbox controls are grouped together in the list of controls for the page.
Since Visual Studio 2010, there is absolutely no reason to use Hungarian Notation.
The only reason one could imagine - to easily search for similar controls with intellisense, goes away with new intellisense which searches in full text.
Thus typing Text
in code editor finds you all: firstNameText
, lastNameText
, anyText
.
And it's much easier to read "firstNameText" than "txtFirstName" in code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With