Newbie here, in C# what is the difference between the upper and lower case String/string?
8 Answers
String uses a few more pixels than string. So, in a dark room, it will cast a bit more light, if your code is going to be read with light-on-dark fonts. Deciding on which to use can be tricky - it depends on the price of lighting pixels, and whether your readership wants to cast more light or less. But c# gives you the choice, which is why it is all-around the best language.
5 Comments
An object of type "String" in C# is an object of type "System.String", and it's bound that way by the compiler if you use a "using System" directive, like so: using System; ... String s = "Hi"; Console.WriteLine(s); If you were to remove the "using System" statement, I'd have to write the code more explicitly, like so: System.String s = "Hi"; System.Console.WriteLine(s); On the other hand, if you use the "string" type in C#, you could skip the "using System" directive and the namespace prefix: string s = "Hi"; System.Console.WriteLine(s); The reason that this works and the reason that "object", "int", etc in C# all work is because they're language-specific aliases to underlying .NET Framework types. Most languages have their own aliases that serve as a short-cut and a bridge to the .NET types that existing programmers in those languages understand.