+ 1

What will the char data type look like in binary in c #?

27th Mar 2020, 9:07 PM
Mary_d9
Mary_d9 - avatar
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
27th Mar 2020, 9:22 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Denise Roßberg ok,thank you)
28th Mar 2020, 10:52 AM
Mary_d9
Mary_d9 - avatar
+ 1
Denise Roßberg What about the data types string and object?
28th Mar 2020, 5:33 AM
Mary_d9
Mary_d9 - avatar
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..
28th Mar 2020, 10:42 AM
Denise Roßberg
Denise Roßberg - avatar