C# case sensitive or not

  • Thread starter Finn Stampe Mikkelsen
  • Start date
F

Finn Stampe Mikkelsen

Hi

I'm totally new to C#, but have worked a bit with VB.NET...

trying to migrate to C#, i find one thing particular anoying... The case
sensitivity of C# or at least my C# environment of Visual Studio. Can this
be disabled??

I mean, it's hard enough to learn a new language, but to also remember that
listBox is spelled exactly like that with all small letter, but for the
capital B. And if not written like that i get an error...

Pse. help... if possible

/Finn

--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary ant those who
don't.
Es gibt 10 arten von menschen. Die die binär verstehen bzw. die die es nicht
tuhen
 
C

Chris Mullins [MVP - C#]

C# is case sensitive. So is Java, C, and C++, and a number of other
languages.

I personally think case sensivitity in a language is pretty silly, and much
prefer the VB approach. Unfortunatly, it's not something that's going to
change anytime soon...

In Visual Studio, you can work around this by hitting "Control-Space" alot.
This will auto-complete what you're typing, and fix the casing. If you're
already typed "messagebox", and hit "Control-Space" while your cusor is in
there, it'll change it to "MessageBox".
 
L

Liz

Finn Stampe Mikkelsen said:
Hi

I'm totally new to C#, but have worked a bit with VB.NET...

trying to migrate to C#, i find one thing particular anoying... The case
sensitivity of C# or at least my C# environment of Visual Studio. Can this
be disabled??

I mean, it's hard enough to learn a new language, but to also remember
that listBox is spelled exactly like that with all small letter, but for
the capital B. And if not written like that i get an error...

Pse. help... if possible

lol .. how do you deal with things like bad weather, war, greed, hunger ?
look, I'll get this case-sensitivity thing fixed for you ...
 
M

Michael S

Hehe.

I've been working in Delphi a lot,
and one of the key features missing;
was to be able to turn case-sens ON

- Michael Starberg
 
G

Guest

I HATE VB's case insensitivity.

VB6 would automatically change the case of identifiers to what it thought
was the correct case - ugh! Does VB .Net still do this?

Case sensitivity allows a language to be a bit more expressive. That fact
that VB does not have it is just another demonstration of why it is for
kiddies.

Let the language wars commence!
 
S

sloan

C# is case sensitive.

It's a discipline, one you'll quickly learn.

.........

I am thankful there is not a "disable case sensitivity" "feature" for C#.
My opinion is that case insensitive code is ugly.
 
L

Liz

I am thankful there is not a "disable case sensitivity" "feature" for C#.

for my nickel, it's actually insane, and leads to code like:

networkPackectsPerSecond = NetworkPackectsPerSecond;

which, ultimately, wastes a lot of time and strains a lot of eyes; I cannot
even begin to imagine a sensible rationale for case-sensitivity

that said, I'm used to it and don't really care

now, what really drove me crazy were the VB IDEs .. where you type:

let a = 1233

and the editor immediately transformed it to:

Let a = 1233

I won't even bother whining about the "Let" keyword ....

My opinion is that case insensitive code is ugly.

you can always write your case-insensitive code as though it actually were
case-sensitive, no?
 
A

Alun Harford

Liz said:
for my nickel, it's actually insane, and leads to code like:

networkPackectsPerSecond = NetworkPackectsPerSecond;

which, ultimately, wastes a lot of time and strains a lot of eyes; I cannot
even begin to imagine a sensible rationale for case-sensitivity

Well I read that as "set the local variable networkPackectsPerSecond to
the value of the property NetworkPackectsPerSecond"

Alun Harford
 
J

Jon Skeet [C# MVP]

Alun Harford said:
Well I read that as "set the local variable networkPackectsPerSecond to
the value of the property NetworkPackectsPerSecond"

Exactly - and I prefer that to having to use prefixes and things to
indicate what's a variable, just because the language isn't capable of
differentiating things that a human clearly can.
 
G

Guest

Adrian said:
Case sensitivity allows a language to be a bit more expressive. That fact
that VB does not have it is just another demonstration of why it is for
kiddies.

Are you a master if the two languages for kiddies called Ada and PL/I ?

:)

Arne
 
L

Liz

Jon Skeet said:
Exactly - and I prefer that to having to use prefixes and things to
indicate what's a variable, just because the language isn't capable of
differentiating things that a human clearly can.

is it really a significant burden to write:

networkPackectsPerSecond = _networkPackectsPerSecond
-- instead of --
networkPackectsPerSecond = NetworkPackectsPerSecond

which do you suppose you could recognize more quickly in a well-controlled
laboratory test?

Humans can also (generally) read instructions in 6 pt type on medicine
bottles but sometimes they read it wrong and get sick or die

this IS a language that won't let you use pointers we're talking about ...
seems a bit inconsistent in approach to me
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Liz said:
is it really a significant burden to write:

networkPackectsPerSecond = _networkPackectsPerSecond
-- instead of --
networkPackectsPerSecond = NetworkPackectsPerSecond

which do you suppose you could recognize more quickly in a well-controlled
laboratory test?

Humans can also (generally) read instructions in 6 pt type on medicine
bottles but sometimes they read it wrong and get sick or die

this IS a language that won't let you use pointers we're talking about ...
seems a bit inconsistent in approach to me

I think underscore is a bad example - that can actually also
be missed in certain fonts & displays.

I would also prefer programming languages to be case insensitive.

But there are not much point in this discussion.

Someone decided that C# should follow the C++ and Java tradition.

It is 100% sure that it will never be changed. It would break a
lot of code.

Learn to live with it.

Arne
 
J

Jon Skeet [C# MVP]

Liz said:
is it really a significant burden to write:

networkPackectsPerSecond = _networkPackectsPerSecond
-- instead of --
networkPackectsPerSecond = NetworkPackectsPerSecond

I find the readability of the first to be less. The extra underscore
gets in the way of my mental reading.
which do you suppose you could recognize more quickly in a well-controlled
laboratory test?

Humans can also (generally) read instructions in 6 pt type on medicine
bottles but sometimes they read it wrong and get sick or die

this IS a language that won't let you use pointers we're talking about ...

Not a good choice of example, seeing as C# *does* let you use pointers.
seems a bit inconsistent in approach to me

It's entirely consistent with C#'s syntax approach being the same as
Java, C, C++.
 
L

Liz

Jon Skeet said:
Not a good choice of example, seeing as C# *does* let you use pointers.


It's entirely consistent with C#'s syntax approach being the same as
Java, C, C++.


c'mon, Jon, you get the gist of what I'm saying: C# is heavily biased
towards a paternalistic protect yourself (or your employer) from your own
stupidity approach .. which is not at all consistent with C/C++ ...
 
J

Jon Skeet [C# MVP]

Liz said:
c'mon, Jon, you get the gist of what I'm saying: C# is heavily biased
towards a paternalistic protect yourself (or your employer) from your own
stupidity approach .. which is not at all consistent with C/C++ ...

Well, it has avoided some (but not all) of the ways of shooting you in
the foot that C and C++ have. But then, I don't remember the last time
that I *did* shoot myself in the foot with C# due to case sensitivity.

If you don't trust yourself not to write:

Foo = Foo;

instead of

Foo = foo;

then you can still use prefixes if you *want* to.

I'm personally glad that C# is case-sensitive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top