Hello everyone,
I'm trying to do an hex editor in C#. My plan is to read a file byte by byte and display the byte in a text box.
I have the code bellow but it works very slow. Does anyone know why it works so slow ??
/// <summary>
/// Opens a file chooser.
/// </summary>
///
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog.ShowDialog();
string fileName = openFileDialog.FileName;
FileStream fileReader = new FileStream(fileName, FileMode.Open, FileAccess.Read);
long length = fileReader.Length;
long position = 0;
while (position < length){
position++;
textBox.Text += fileReader.ReadByte() + " ";
}
}
Best regards