Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case Sensitivity ? on or off

Status
Not open for further replies.

TWillard

Programmer
Apr 26, 2001
263
US
Is it possible to tell VB.NET to reconize case sensitive variables and method names?

VALID IN C#
-------------
private bool canSelect;
public bool CanSelect
{
....
}

INVALID in VB.NET
------------------
private canSelect as Boolean
public property CanSelect as Boolean
.....
end property

? Is there any property that I can set to make VB.NET recognize and acknoledge case sensitive variables as being different?

Thanks in advance.
 
As far as I know - No.

What I usually do for my classes is to name private class variables (fields) beginning with an underscore (as in _canSelect). That serves two purposes: 1 - Whenever I see a variable that starts with an underscore, I know it's a private class field. 2 - I can use the same name (without the underscore character) to name my class properties.

Back when I was in college, I was in a programming class where we had a big debate on whether it was good or bad for a programming language to be case sensitive. The strongest argument of those who favored case sensitivity was that there are more choices to name a variable. One of the students was brave enough to comment "case sensitivity is good..." and he dared to ask "what if you run out variable names?"

I always found it ridiculous for programming languages to be case sensitive as they force the programmer to type in a variable name the same way everywhere such variable appears. If the programmer happens to be a bit indicisive in his typing, he'll come accross non-sense syntax errors that will just slow him down.

Worse yet, if a programmer likes to use several case variations of the same name to represent different variables (e.g. canRead, CanRead, Canread), it will be very likely that another programmer that reads his code will have a hard-time understanding it - again resulting in unnecessary development slow-down.

Now, compare what I've just said to "what if you run out of variable names?" But then, again, it all comes down to what you feel more comfortable with...

JC

Friends are angels who lift us to our feet when our wings have trouble remembering how to fly...
 
JCruz063, Thanks for the input.

I also use the technique of using underscores for private class level variables, while using the name w/o the underscore on functions, methods or properties.

You are absolutely correct. "It all comes down to what you are more compfortable with."

The reason that I brought this topic up is b/c I am currently switching back and forth between VB.NET and C#. C# supports case sensitive variables.

IMHO ... it would be nice feature to have.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top