+ 1
What will the char data type look like in binary in c #?
4 Answers
+ 5
Each char has an ascii value.
For example a = 97.
char c = 'a';
string binary = Convert.ToString(c, 2);
This method returns the binary value of an integer or char.
The first parameter is your number/char you want to convert, the second parameter is the base (binary has base 2).
https://docs.microsoft.com/de-de/dotnet/api/system.convert.tostring?view=netframework-4.8
+ 2
Denise RoĂberg ok,thank you)
+ 1
Denise RoĂberg What about the data types string and object?
0
String:
Here you can use a loop to convert each ascii value of the character into a binary number.
Objects:
I don't know how this should work..