As I've been broadcasting a
series of webcasts for MSDN, a number of people have asked me about the naming conventions I use for variable names in my code. There's nothing like coding live in front of 1000 people to make you self-conscious about your coding style :) For the most part, I have adopted the recommended
standards set by Microsoft (and the .NET programming community at large). This means camel case for member variables, pascal case for type names, and so on.
However, when I'm writing ASP.NET or WinForms code, I often find it useful to name control member variables with the type of control (sort of an inverted Hungarian notation). For example, if I had a textbox on a form for a person's name, I would create a corresponding variable in my form class:
TextBox nameTextBox;
I find this useful because I then know that the variable is a control and I know what type of control it is. I haven't found any documented conventions along these lines, and I was wondering if anyone else follows this (or a similar) convention when naming control variables? If so, please post a comment here and let me know.
Posted
Dec 29 2004, 03:02 PM
by
fritz-onion