Conversion between decimal integers and other binary strings.
Hexadecimal in c# is represented by the prefix 0x.
int c = 0x1000;
1. Use (number, baseValue) to convert decimal integers into strings in other binary formats.
When used in conjunction, conversion between arbitrary bits can be achieved.
1. Decimal integers to binary strings
(69, 2)
2. Decimal to octal string
(69, 8)
3. Decimal to hexadecimal string
(69, 16) //or("X2") //or:(“{0:X},69”)
2. Use Convert.ToInt32/ToByte(strNumber, baseValue) to convert other binary strings into decimal integers.
1. Binary string to decimal integer
Convert.ToInt32(”100111101″, 2)
2. To convert octal string into decimal
Convert.ToInt32(”76″, 8)
3. Hexadecimal string to decimal
Convert.ToInt32(”FFFF”, 16) //or("FF",) ("FF",16) //or("FF",)
This is all about this article about C# implementing binary conversion. I hope it will be helpful to everyone's learning and I hope everyone will support me more.