How to convert Decimal to binary C# (4 bits) -



How to convert Decimal to binary C# (4 bits) -

this question has reply here:

byte binary string c# - display 8 digits 3 answers

i want convert decimal numbers binary, i'm using way

private string strtobin(string input) { int number = convert.toint32(input) ; string res = convert.tostring(number, 2); homecoming res; }

it's working when i'm having illustration "6" i'm getting 110 instead of 0110? tips?!

simple string modification:

string res = convert.tostring(number, 2); res = new string('0', 8 - res.length) + res;

c# binary decimal

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -