=====Conversion d'un nombre entier en hexadécimal et inversement===== // Store integer 182 int intValue = 182; // Convert integer 182 as a hex in a string variable string hexValue = intValue.ToString("X"); // Convert the hex string back to the number int intAgain = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber); [[http://www.geekpedia.com/KB8_How-do-I-convert-from-decimal-to-hex-and-hex-to-decimal.html|How do I convert from decimal to hex and hex to decimal? (C# Knowledge Base) • Geekpedia]], {{ :lang:csharp:nombres:how_do_i_convert_from_decimal_to_hex_and_hex_to_decimal_c_knowledge_base_geekpedia.html.zip |Archive}} =====Utiliser des nombres en représentation binaire===== On ne peut pas encore (c#7 peut-être). Une alternative : ''Convert.ToInt32("1000111001", 2);'' =====Convertir un nombre en texte conformément à un format===== 15.ToString("000"); Et pour forcer l'affichage des signes, il faut utiliser un pattern. Le premier est le format si le nombre est positif, le second si le nombre est négatif, le troisième est si le nombre est nul. 15.ToString("+000;-000;+000");