0

Constant names can contaion spaces ?? Like this : const int my age or const int myage ?

20th Feb 2017, 7:55 PM
Bassel AbdelSabour
Bassel AbdelSabour - avatar
5 Respostas
+ 3
If you are talking about variables then NO
20th Feb 2017, 8:07 PM
shashi prakash
shashi prakash - avatar
+ 1
constant identifiers does not contain spaces..
21st Feb 2017, 4:38 AM
Rajendra Boke
Rajendra Boke - avatar
+ 1
It's the typical convention to represent a constant in c# using Pascal case. Where the first letter of every word is capitalized with no spaces and usually no underscores between words. Some however prefer Hungarian notation where all the letters are capitalized and there is an underscore between each word. example: Pascal case: const int MyAge; Hungarian: const int MY_AGE; but no spaces are not allowed and will give a compiler error. I suggest you choose 1 of the above and stick with it for code readability.
21st Feb 2017, 6:30 AM
ChaoticDawg
ChaoticDawg - avatar
- 1
but in const it's ok right? like this : const my age = 34
20th Feb 2017, 8:08 PM
Bassel AbdelSabour
Bassel AbdelSabour - avatar
- 1
No, it's not valid if you use const.
20th Feb 2017, 9:30 PM
DaemonThread
DaemonThread - avatar