Why is C# case sensitive?
I am not having a good time running through a small C# article regarding Automation.
While writing code, I don't want to worry about whether I wrote "int" or "INT". I'd rather focus on achieving something, not making it 'look right'. It's going to be those days of JavaScript again, where I had to spend 15 minutes debugging a large function only to find out that I had misspelt the word textArea. :rolleyes:
Why is C# case sensitive? This is really sad... why didn't they just give VB.NET all the features that C# has to itself exclusively and let us live in peace? Or, if they really wanted something that was close to C/C++/Java, why not allow for case insensitivity? It would be a refreshing change. Just because people have been doing something (dare I say dumb) for 20 years does not mean it should continue. Make a change!!
I actually googled this and came across this article. This has to be the worst excuse I've ever seen:
Quote:
Perhaps surprisingly to you, we didn't spend a lot of time on this question while designing C#. Rather, we felt that this was clearly a matter that had good arguments on both sides, and was largely a matter of taste, preference, and former experience. Given that, we didn't see a good reason to change from the precedent set by C and C++. In this matter, as with numerous other aspects of the language, such as using curly braces for blocks, ending statements with a semi-colon, the syntax of loop statements, etc. we deliberately chose not to change what C and C++ used. This allowed the basics of the language to be familiar to C and C++ users, so that people can concentrate their attention on a smaller number of features where we felt we could provide significant additional value over C and C++.
:ehh:
I am now going to take a printout of this quote and use it to wipe the grime from underneath my desk.
:mad:
Re: Why is C# case sensitive?
I've never used anything but notepad/wordpad when with java. It made me even more aware of my small mistakes such as typos, ect.
Re: Why is C# case sensitive?
Quote:
Originally Posted by mendhak
Why is C# case sensitive? This is really sad... why didn't they just give VB.NET all the features that C# has to itself exclusively and let us live in peace? Or, if they really wanted something that was close to C/C++/Java, why not allow for case insensitivity? It would be a refreshing change. Just because people have been doing something (dare I say dumb) for 20 years does not mean it should continue. Make a change!!
I couldn't agree with you more. It's a known fact that case-sensitivity is a stumbling block, especially for beginners. The creator of Python even admitted this (case-sensitivity) is one of the things wrong with Python (along with int division: where 7/4 = 1 instead of 1.75).
There is no reason why the Microsoft developers could not add a case-insensitive option to the C# compiler (you could turn it on or off however you choose). I implemented a case-insensitive option myself for the boo programming language: http://jira.codehaus.org/browse/BOO-128
I also fixed the int division thing: http://jira.codehaus.org/browse/BOO-208
There is one reason FOR case-sensitivity though, it makes source code a little more readable and standardized. Case-insensitivity though is much more easily writeable than it is less readable.
Re: Why is C# case sensitive?
case senative == streangth == not lazy == advantage == frog (base data var for the frog database class) Frog (class you use)
It's not super useful but I think it's better to know what your typing than not.... and things like operator overloading are possible because of all the rules in C#
Face it C# is a dumbed up version of C++ based on the framework. VB is a even dumber version of a powerful language(don't throw stuff at me). VB 6 is like lego block that don't match being put together with a mallet. GPF in subclass.dll....
If this is giving you trouble stick with VB :thumb:
Re: Why is C# case sensitive?
Quote:
Originally Posted by hellswraith
I found that the VB auto casing your variables was cool when I was working in VB. It helped make sure I wrote it right and gave me visual feedback. BUT, in C# (you can do this in VB as well), I now use something I find much better. That is variable completion. Start typing your variable name, and hit Ctrl-Space. The intellisense window will open if your variable name that you typed so far matches more than one match, but if it doesn't match anything else, it will fill it in for me. Example:
In a C# method, do this:
string myReallyCoolString = "";
then type this:
myR
Hit Ctrl-Space and it will fill in with:
myReallyCoolString
This saves me A LOT of time typing. I hardly ever type out a variable name completely anymore. If you don't use it yet, use it, it will save you a lot of time.
sweet
Re: Why is C# case sensitive?
Comming from coding in Java for quite a number of years learning C# should pose less of a problem for me than someone comming from Vb but some of C#'s syntax seems a bit weird. Why is a language specific class type such as string defined as lower case and it's methods defined as starting in uppercase?
Re: Why is C# case sensitive?
Because the .net framework is based on Uppercase starting methods and properties.... System.String is simple pointed to by string. string is lowercase because it s more the way things work in C++ System.String the members it provides are uppercase for all .net framework languages.
If I made my own language we'll call it Bob the Builder I could make a string type for my language called bob_string or _string or __bs it would still have the same mebers and member name case as System.String....
For that matter I can make the bob_string type in C# if I wanted to let's say add some extra string methods like Encrypt or something.....
Re: Why is C# case sensitive?
Quote:
Posted by Magiaus
Because the .net framework is based on Uppercase starting methods and properties....
So i guess C# and Java are opposites in that respect.
Code:
String s = "hello"; // Java
int i = s.length();
string s = "hello";
int i = s.Length(); // I guess C# please correct me if i am wrong
Re: Why is C# case sensitive?
I guess so. There is no String in C++ only char. You have to include a header to get String. When adding a string class to the base language I assume they wanted to keep the convection where int, bool, double, float and so on where already lowercase it only makes since that when adding String it would be string not String.
Re: Why is C# case sensitive?
Quote:
Posted by Magiaus
When adding a string class to the base language I assume they wanted to keep the convection where int, bool, double, float and so on where already lowercase it only makes since that when adding String it would be string not String.
Yes but sbyte int short ect.... are primative types whereas string is a composite type. I would think that when creating a language you would want to support some type of syntactical differentation.
Re: Why is C# case sensitive?
In the framework they are complex types though. Provinding new and extended functionality. int in C++ is int16 int in C# is int32. All the C# keywords are lower and string is a C# keyword. It's the convection the language takes to hold with C/C++ look at int.Parse and so on the entire language is this way and string is a base part of the language.
At least you don't have to worry with __gc class and all the C++ extras need to use the framework. Casting pointers and so on can be insane in c++ to managed code.
It's all about the framework, the language is up to you. C# has operator overloading. Meaning I can make a collection call the add method by going
Code:
mCustomArray++ object;
if I overloadd the + operator. That's about the biggest thing C# does that say VB doesn't. Or I could make an int class that ++ would subtract.
Re: Why is C# case sensitive?
Quote:
Posted by Magiaus
look at int.Parse and so on the entire language is this way and string is a base part of the language.
int.Parse just looks to me like an automatic boxing operation for a language that has a lack of wrapper types which then means the type system is unified such that a value of any type can be treated as an object.
Magiaus do you know where i can find C# API documentation? I looked all over microsofts site with no luck. Thank you for the help. :thumb:
Re: Why is C# case sensitive?
Honestly I havent looked into it for a year or two. You have to look into Reflection, Interop, and Marshaling. Basicly you declare the API simular to the way you would in VB6. You have to do this for any structs and so on. It is a bit frustrating. I went as far as making a C++ wrapped .net API lib but I lost the work. I wrapped around 60 of the Win32 API but the deeper I went into the API and the framework the more redundent it got. I can usually find a way without API. Unless I want to do hooks or something.
Truthfully I got to the memory API and my brain melted because CopyMemory was returning the same handle for any framework type a unique handle for each type but the same on every instance. Even if I made like 1,000. I got all dizzy thinking about garbage collection, object instances and I went into a C++ indused comma.
I couldn't think of unified for some reason. That's what it is is a unified type system. As far as the boxxing and unboxxing goes it's beyond me. I gave up on learning C++ until someone is going to pay me to use it....
Re: Why is C# case sensitive?
:lol: All i wanted was a link to the API.
Re: Why is C# case sensitive?
Quote:
Originally Posted by Dilenger4
:lol: All i wanted was a link to the API.
Sorry I'm slow. http://msdn.microsoft.com/library/de...start_page.asp
Re: Why is C# case sensitive?
Quote:
Originally Posted by Dilenger4
So i guess C# and Java are opposites in that respect.
Code:
String s = "hello"; // Java
int i = s.length();
string s = "hello";
int i = s.Length(); // I guess C# please correct me if i am wrong
Code:
//C#
String s = "hello";
works just the same as using a lower 'string s'. It creates the same intermediate language instructions.
Re: Why is C# case sensitive?
Quote:
Originally Posted by nemaroller
Code:
//C#
String s = "hello";
works just the same as using a lower 'string s'. It creates the same intermediate language instructions.
as long and you have
Re: Why is C# case sensitive?
lol, i suppose, but then you're not getting much written without the system library.
Re: Why is C# case sensitive?
I'm just being picky, but I forced myself to not use any using statements for the past year to ingrain the framework into my brain. I think I must be crazy. I know I typed twice as much junk for no reason....
Re: Why is C# case sensitive?
I've done that too.. .except where I work now... its considered back programming practice (against their defined standards) to use the fully qualified name.. instead of placing a using statement at the top.