By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

VS 2005 - Case Sensitivity?

P: n/a
Is there any options in VS 2005 to better handle case issues in C# (Similar
to VB.Net)?
Jan 20 '06 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Not sure that I understand your question .... C# is, by it's nature case
sensitive .... so that is not a configurable option ....
gregory_may wrote:
Is there any options in VS 2005 to better handle case issues in C# (Similar
to VB.Net)?

Jan 20 '06 #2

P: n/a
> Is there any options in VS 2005 to better handle case issues in C#
(Similar to VB.Net)?


You would not want to do that since writing code of this kind:

MyType myType = new MyType();

Is a widespread (and valid, language-wise) practice... Or did I
misunderstand your question?
Jan 20 '06 #3

P: n/a
It sounds like what you are asking is "Is there any way I can make the C#
language be case-insensitive like Visual Basic.NET?"

The answer is, of course, no, you cannot. C# is case - sensitive,, as is
C++, Javascript, and the Unix filesystem. That's a good thing!
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"gregory_may" wrote:
Is there any options in VS 2005 to better handle case issues in C# (Similar
to VB.Net)?

Jan 20 '06 #4

P: n/a
Ok, last time I was using VS2003 with C# the editor seemed to get confused
if I was using different cases (or a typo).

In VB.Net, the editor can always find the right object (since it doesn't
care about case).

Has the Editor improved any to let me better use auto-complete
(intellisense) on mixed case objects ...or at least help me identify a typo?

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:5B**********************************@microsof t.com...
It sounds like what you are asking is "Is there any way I can make the C#
language be case-insensitive like Visual Basic.NET?"

The answer is, of course, no, you cannot. C# is case - sensitive,, as is
C++, Javascript, and the Unix filesystem. That's a good thing!
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"gregory_may" wrote:
Is there any options in VS 2005 to better handle case issues in C#
(Similar
to VB.Net)?

Jan 20 '06 #5

P: n/a
Yes, as you start to type, intellisense suggests auto-completions for what
you are typing, regardless of the casing. If you select an element off the
list, it is pasted with the correct casing.

Also, the identifier is colored in black if it could not be found. It is
greenish-colored if it could be found, so you can see at a glance if the
class/struct/etc... can be seen by VS.
Jan 20 '06 #6

P: n/a
Me
2 words.. not trying to be mean but it will probably come across that way

"Program better!"

Not wanting to care about case is IMHO crazy.. I hate looking through code
that looks like this:

int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

Now that is an extreme example but it kind of shows what I mean. If you
call something MyID then call it that.

If you really dont want to worry about case then just use all lower
letters.. At least all references to the variables would be consistant.

int myid;
myid=10;
if(myid > 100)
myid = 1;
else
myid++;
Consistancy is rule #1 in my book. No matter what you are talking about.

"gregory_may" <None> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
Is there any options in VS 2005 to better handle case issues in C#
(Similar to VB.Net)?

Jan 20 '06 #7

P: n/a
Awesome!

It felt like my left foot was cut off in VS2003. I refused to use C#
because the editor was so poorly integrated (compared to VB.NET)..... sounds
like I can finally start looking at C# again.

"Gabriel Magaña" <no*****@no-spam.com> wrote in message
news:er**************@TK2MSFTNGP14.phx.gbl...
Yes, as you start to type, intellisense suggests auto-completions for what
you are typing, regardless of the casing. If you select an element off
the list, it is pasted with the correct casing.

Also, the identifier is colored in black if it could not be found. It is
greenish-colored if it could be found, so you can see at a glance if the
class/struct/etc... can be seen by VS.

Jan 20 '06 #8

P: n/a
<"gregory_may" <None>> wrote:
Awesome!

It felt like my left foot was cut off in VS2003. I refused to use C#
because the editor was so poorly integrated (compared to VB.NET)..... sounds
like I can finally start looking at C# again.


Actually, that behaviour was in VS 2003 for C# as well. Just hit
Ctrl-Space to complete something regardless of case.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 20 '06 #9

P: n/a
VS2003 Intellisense also does case-insensitive identifier completion.
Problems crop up for me only when I use two identifiers that differ
only by case, for example:

public class A
{
private string abcd;
...
public string Abcd { get { return this.abcd; } }
}

within class A, typing "this.abcd" would choose either the field or the
property, depending upon which was more often used. I solved the
problem simply by changing conventions for naming identifiers.

Jan 20 '06 #10

P: n/a
> int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++; The thing is, if this code were written in the case-insensitive VB.NET, the
background compiler would change all variations of MyID to match the
definition. You'd never see code like that.

What *I* hate is seeing two variables names that differ only by the case of
a single letter. To me, its more likely to that someone reading this type
of code would be mistaken about which variable they were actually looking
at.
"Program better!" The subjective opinion on case-sensitivity has nothing to do with
programming "better". There are plenty of programmers on either side of
this issue.

- Mitchell S. Honnert
"Me" <me@home.com> wrote in message
news:v7******************************@comcast.com. ..2 words.. not trying to be mean but it will probably come across that way

"Program better!"

Not wanting to care about case is IMHO crazy.. I hate looking through code
that looks like this:

int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

Now that is an extreme example but it kind of shows what I mean. If you
call something MyID then call it that.

If you really dont want to worry about case then just use all lower
letters.. At least all references to the variables would be consistant.

int myid;
myid=10;
if(myid > 100)
myid = 1;
else
myid++;
Consistancy is rule #1 in my book. No matter what you are talking about.

"gregory_may" <None> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
Is there any options in VS 2005 to better handle case issues in C#
(Similar to VB.Net)?


Jan 20 '06 #11

P: n/a
Me
I just think of programming as more of an art form.. Creating something
usefull that also looks pleasing to the eyes.

In the end it is always personal preference on what you do in your own code.
I just know that when I look at code I like to see things that are easy to
follow and understand.

Having multiple variables that are different only by the case is a big no-no
in my book as well. The only time this could be considered valid is if it is
a parameter of a method.

Ex. would be something like this:

int UserNumber; // member variable in a class

String SetUserNumber(int usernumber)
{
UserNumber = usernumber;
}

Just my 2 cents I guess..

"Mitchell S. Honnert" <ne**@REMhonnertOVE.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

The thing is, if this code were written in the case-insensitive VB.NET,
the background compiler would change all variations of MyID to match the
definition. You'd never see code like that.

What *I* hate is seeing two variables names that differ only by the case
of a single letter. To me, its more likely to that someone reading this
type of code would be mistaken about which variable they were actually
looking at.
"Program better!"

The subjective opinion on case-sensitivity has nothing to do with
programming "better". There are plenty of programmers on either side of
this issue.

- Mitchell S. Honnert
"Me" <me@home.com> wrote in message
news:v7******************************@comcast.com. ..
2 words.. not trying to be mean but it will probably come across that way

"Program better!"

Not wanting to care about case is IMHO crazy.. I hate looking through
code that looks like this:

int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

Now that is an extreme example but it kind of shows what I mean. If you
call something MyID then call it that.

If you really dont want to worry about case then just use all lower
letters.. At least all references to the variables would be consistant.

int myid;
myid=10;
if(myid > 100)
myid = 1;
else
myid++;
Consistancy is rule #1 in my book. No matter what you are talking about.

"gregory_may" <None> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
Is there any options in VS 2005 to better handle case issues in C#
(Similar to VB.Net)?



Jan 20 '06 #12

P: n/a
> In the end it is always personal preference on what you do in your own
code. True enough.
I just know that when I look at code I like to see things that are easy to
follow and understand. So...readability is in the eye of the beholder? ;-) Of course, any
programmer is going to agree that easy-to-follow and understandable code is
preferable, but objectively what promotes this? You can say that one
shouldn't name variables in such a way that case-sensitivity would cause
confusion, but in my opinion case-insensitivity naturally promotes
easy-to-understand code. There are a near-infinite number of variable names
you can use; why risk confusion by, for example, having the private member
variable and the public property name be the same except for case?
String SetUserNumber(int usernumber) I think the MS naming standard says to use camelCase for parameter names.
userNumber? :-)

- Mitchell S. Honnert


"Me" <me@home.com> wrote in message
news:fZ********************@comcast.com...I just think of programming as more of an art form.. Creating something
usefull that also looks pleasing to the eyes.

In the end it is always personal preference on what you do in your own
code. I just know that when I look at code I like to see things that are
easy to follow and understand.

Having multiple variables that are different only by the case is a big
no-no in my book as well. The only time this could be considered valid is
if it is a parameter of a method.

Ex. would be something like this:

int UserNumber; // member variable in a class

String SetUserNumber(int usernumber)
{
UserNumber = usernumber;
}

Just my 2 cents I guess..

"Mitchell S. Honnert" <ne**@REMhonnertOVE.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

The thing is, if this code were written in the case-insensitive VB.NET,
the background compiler would change all variations of MyID to match the
definition. You'd never see code like that.

What *I* hate is seeing two variables names that differ only by the case
of a single letter. To me, its more likely to that someone reading this
type of code would be mistaken about which variable they were actually
looking at.
"Program better!"

The subjective opinion on case-sensitivity has nothing to do with
programming "better". There are plenty of programmers on either side of
this issue.

- Mitchell S. Honnert
"Me" <me@home.com> wrote in message
news:v7******************************@comcast.com. ..
2 words.. not trying to be mean but it will probably come across that way

"Program better!"

Not wanting to care about case is IMHO crazy.. I hate looking through
code that looks like this:

int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

Now that is an extreme example but it kind of shows what I mean. If you
call something MyID then call it that.

If you really dont want to worry about case then just use all lower
letters.. At least all references to the variables would be consistant.

int myid;
myid=10;
if(myid > 100)
myid = 1;
else
myid++;
Consistancy is rule #1 in my book. No matter what you are talking about.

"gregory_may" <None> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
Is there any options in VS 2005 to better handle case issues in C#
(Similar to VB.Net)?



Jan 20 '06 #13

P: n/a
Me
Doh!!! My bad! :-)
"Mitchell S. Honnert" <ne**@REMhonnertOVE.com> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
String SetUserNumber(int usernumber)

I think the MS naming standard says to use camelCase for parameter names.
userNumber? :-)

- Mitchell S. Honnert


"Me" <me@home.com> wrote in message
news:fZ********************@comcast.com...
I just think of programming as more of an art form.. Creating something
usefull that also looks pleasing to the eyes.

In the end it is always personal preference on what you do in your own
code. I just know that when I look at code I like to see things that are
easy to follow and understand.

Having multiple variables that are different only by the case is a big
no-no in my book as well. The only time this could be considered valid is
if it is a parameter of a method.

Ex. would be something like this:

int UserNumber; // member variable in a class

String SetUserNumber(int usernumber)
{
UserNumber = usernumber;
}

Just my 2 cents I guess..

"Mitchell S. Honnert" <ne**@REMhonnertOVE.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;
The thing is, if this code were written in the case-insensitive VB.NET,
the background compiler would change all variations of MyID to match the
definition. You'd never see code like that.

What *I* hate is seeing two variables names that differ only by the case
of a single letter. To me, its more likely to that someone reading this
type of code would be mistaken about which variable they were actually
looking at.

"Program better!"
The subjective opinion on case-sensitivity has nothing to do with
programming "better". There are plenty of programmers on either side of
this issue.

- Mitchell S. Honnert
"Me" <me@home.com> wrote in message
news:v7******************************@comcast.com. ..
2 words.. not trying to be mean but it will probably come across that
way

"Program better!"

Not wanting to care about case is IMHO crazy.. I hate looking through
code that looks like this:

int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

Now that is an extreme example but it kind of shows what I mean. If
you call something MyID then call it that.

If you really dont want to worry about case then just use all lower
letters.. At least all references to the variables would be consistant.

int myid;
myid=10;
if(myid > 100)
myid = 1;
else
myid++;
Consistancy is rule #1 in my book. No matter what you are talking
about.

"gregory_may" <None> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
> Is there any options in VS 2005 to better handle case issues in C#
> (Similar to VB.Net)?
>



Jan 20 '06 #14

P: n/a
Is there any plug-in or macro or option for the a case crippled programmer?

It would be nice to see a warning if two variables show up with differing
case. This is my biggest timewaster when using C#.

I respect all the folks that really find the below code an art form (I might
think your crazy, but I respect your opinions), but for me its just
silliness that VS cant help me keep this from happening.
"Mitchell S. Honnert" <ne**@REMhonnertOVE.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

The thing is, if this code were written in the case-insensitive VB.NET,
the background compiler would change all variations of MyID to match the
definition. You'd never see code like that.

What *I* hate is seeing two variables names that differ only by the case
of a single letter. To me, its more likely to that someone reading this
type of code would be mistaken about which variable they were actually
looking at.
"Program better!"

The subjective opinion on case-sensitivity has nothing to do with
programming "better". There are plenty of programmers on either side of
this issue.

- Mitchell S. Honnert
"Me" <me@home.com> wrote in message
news:v7******************************@comcast.com. ..
2 words.. not trying to be mean but it will probably come across that way

"Program better!"

Not wanting to care about case is IMHO crazy.. I hate looking through
code that looks like this:

int MyID;
myid=10;
if(myID > 100)
mYId = 1;
else
myiD++;

Now that is an extreme example but it kind of shows what I mean. If you
call something MyID then call it that.

If you really dont want to worry about case then just use all lower
letters.. At least all references to the variables would be consistant.

int myid;
myid=10;
if(myid > 100)
myid = 1;
else
myid++;
Consistancy is rule #1 in my book. No matter what you are talking about.

"gregory_may" <None> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
Is there any options in VS 2005 to better handle case issues in C#
(Similar to VB.Net)?



Feb 2 '06 #15

P: n/a
I believe that FxCop warns about things like this.

You can download FxCop for free from Microsoft, if you don't have it
already. I also heard rumours that it was built into VS2005, although I
don't know for sure.

Feb 3 '06 #16

This discussion thread is closed

Replies have been disabled for this discussion.