From the course: Visual Basic Essential Training

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Naming your variables

Naming your variables

- [Instructor] We are going to talk about naming rules and naming conventions. Naming rules are what are enforced by the compiler. If you break the rules, you can't compile your code. Naming conventions are suggested ways of naming your variables and other parts of your .NET code. The naming conventions I'm talking about are the Microsoft internal guidelines, and they are common in most .NET libraries and used by lots of .NET developers. We'll start with the rules. I mentioned some of these in the slides. First rule, it must begin with an alphabetic character or an underscore. So, here's an example of a variable that starts with an underscore, and here's one, it starts with an alpha character. They can contain alphabetic characters, decimal digits, and underscores. So, here's an example of one that contains a number in the middle. Here's one that contains an underscore in the middle. Here's an example of a non-valid name because it starts with the number 5, that's not allowed. So if I…

Contents