In C language Octal number can be written by placing 00 before number e.g.
Editor's note: it is a single leading 0 that identifies a number literal as an octal value in C; additional 0 instances have no effect.
int i=0012; //equals 10 in decimal
I found the equivalent of Hexadecimal in C# by placing 0x before number e.g.
int i=0xA; //equals 10 in decimal
Now my question is: Is there any equivalent of Octal Number in C# like in C to represent any number as Octal?
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);
No, there are no octal numbers in C#.
Use public static int ToInt32(string value, int fromBase);
fromBase
Type: System.Int32
The base of the number in value, which must be 2, 8, 10, or 16.
You can't use literals, but you can parse an octal number: Convert.ToInt32("12", 8).
来源:https://stackoverflow.com/questions/4247037/octal-equivalent-in-c-sharp