Why are boolean values converted to string in camel case in C #?

2

Today I came across a peculiarity of C # which I had never stopped to pay attention to:

When converting a value bool to string , the result is a text in camel case :

string verdadeiro = true.ToString(); //Converte para True
string falso = false.ToString(); //Converte para False

However, to use the literal values in the language, you have to write them in lowercase, write them in camel case causes compilation error:

bool verdadeiro = True; //Não compila
bool falso = False; //Não compila

What is the reason for this difference?

    
asked by anonymous 05.09.2017 / 20:16

1 answer

2

This is the decision of the creators of the language and framework , it has nothing specific.

The name returned as a string beginning in uppercase is a common form of use, if you need it different it is easy to manipulate the way you want it.

The lowercase keyword is consistent with the rest of the language which is all in lower case, would not have because these literals would be different from this.

Text representation is something other than value in code.

    
05.09.2017 / 20:27