Why does C#.Net allow the declaration of the string object to be case-insensitive?
String sHello = 'Hello'; string sHello = 'Hello';
Both the lower-case and upper-case S of the word String are acceptable and this seems to be the only object that allows this.
Can anyone explain why?
stringis a language keyword whileSystem.Stringis the type it aliases.Both compile to exactly the same thing, similarly:
intisSystem.Int32longisSystem.Int64floatisSystem.SingledoubleisSystem.DoublecharisSystem.CharbyteisSystem.ByteshortisSystem.Int16ushortisSystem.UInt16uintisSystem.UInt32ulongisSystem.UInt64I think in most cases this is about code legibility – all the basic system value types have aliases, I think the lower case
stringmight just be for consistency.