0
Constant names can contaion spaces ?? Like this : const int my age or const int myage ?
5 Answers
+ 3
If you are talking about variables then NO
+ 1
constant identifiers does not contain spaces..
+ 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.
- 1
but in const it's ok right? like this : const my age = 34
- 1
No, it's not valid if you use const.