Octal equivalent in C#
No, there are no octal number literals in C#.
For strings: Convert.ToInt32("12", 8)
returns 10
.
No there isn't, the language specification (ECMA-334) is quite specific.
4th edition, page 72
9.4.4.2 Integer literals
Integer literals are used to write values of types int, uint, long, and ulong. Integer literals have two possible forms: decimal and hexadecimal.
No octal form.
No, there are no octal literals in C#.
If necessary, you could pass a string and a base to Convert.ToInt32
, but it's obviously nowhere near as nice as a literal:
int i = Convert.ToInt32("12", 8);