In C #, how can I print a number as binary to the console? For example, if I have a uint with a value of 20, how can I type in the console: 00010100 (which is 20 in binary format)?
Convert.ToString (myValue, 2);
With the addition to make the value a byte:
Console.WriteLine(Convert.ToString(number, 2).PadLeft(8, '0'));
int x = 3; string binaryString = Convert.ToString(x, 2); Console.WriteLine(binaryString);
11.
Console.WriteLine(Convert.ToString(20, 2));
Source: https://habr.com/ru/post/1702679/More articles:How to get a script to run automatically before saving the file in Xcode? - xcodeThe best strategy for creating the same HTML when it appears on multiple pages is cssHow to run a script every time I save a file in Linux? - linuxHow to save lucene index in database? - mysqlPeriodically updating ResourceProviderFactory - c #Write a visual studio project from code - c #What is the best way to send emails from a web server to simulate backups and spam? - smtphttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1702683/authorization-authentication-when-doing-ajax-jquery-calls-to-net-web-services-asmx-wcf-etc-what-do-i-need-to-know&usg=ALkJrhhnqk6H_AiGbyKiQnYro_L9WBoHWwWhere is ODBC File DSN in Windows Vista - windowsCSS background url() не отображается в IE, работает в FF/Safari - cross-browserAll Articles