Created
March 29, 2019 03:09
-
-
Save Vitokhv/daa9758e50a88f4a9ddbf5a1ea314572 to your computer and use it in GitHub Desktop.
Форма изменения числа в бинарный формат (числом является номер RDP порта)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void buttonHex_Click(object sender, EventArgs e) | |
{ | |
int value32 = 3389; // Порт RDP в формате Int32 | |
short value16 = (short)value32; // Преобразование int в short (он же Int16) | |
var valueHex = IPAddress.NetworkToHostOrder(value16); // Преобразование значения в сетевой байтовый формат | |
var hex = valueHex.ToString("X"); // Количество знаков (если "X8" то восемь символов) | |
textBoxHex.Text = hex; // Полученное значение выводить в textBox | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Источники: #1