Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
VB.NET General Discussion
Naming Convention for Controls
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="jmcilhinney, post: 185001, member: 641"] I suggest that you just follow Microsoft's recommendations, which basically means [ICODE]camelCase[/ICODE] for private fields, parameters and locals and [ICODE]PascalCase[/ICODE] for everything else. When it comes to the names, I suggest following Microsoft's recommendations again, which means generally not using abbreviations and using names that describe what the thing is or does. For example, a [ICODE]TextBox[/ICODE] that is for a person's given name would be named [ICODE]givenNameTextBox[/ICODE]. Some people may wonder why that's better than [ICODE]txtGivenName[/ICODE], which is shorter. The reason it's better is that the name is not about the type but about the contents. For a [ICODE]String[/ICODE] that actually contains the given name, you would use [ICODE]givenName[/ICODE] rather than [ICODE]strGivenName[/ICODE]. Some people like the fact that using prefixes means that they can quickly find all variables of a particular type in Intellisense by typing that prefix but I think that that shows poor thinking. Again, you should be thinking about what the variable contains, not what its type is. That means that typing "giv" to find a variable related to given name makes more sense than typing "txt" and then looking for the [ICODE]TextBox[/ICODE] you want. Some people say that they might forget what they named something but, again, that indicates poor thinking. If you have named a variable sensibly based on what it contains then how could you forget what you named it? How could you forget that you named a variable that refers to a [ICODE]TextBox[/ICODE] that contains a given name [ICODE]givenNameTextBox[/ICODE]? [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
VB.NET General Discussion
Naming Convention for Controls
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom