I am newbie in C# and recently I tried to make a MD5 hash calculator. But everytime i check some file, the data remains in RAM until i close the program. In 50kb files or so it doesnt matter, but bigger files may not work. Any clues how can it be disposed or cleared after showing the result ? Thanks
private void button1_Click(object sender, EventArgs e)
{
MD5 md5hash = MD5.Create();
string inputMD5;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileloc = openFileDialog1.FileName;
byte[] block = File.ReadAllBytes(fileloc);
byte[] data = md5hash.ComputeHash(block);
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
inputMD5 = sBuilder.ToString();
MessageBox.Show(inputMD5);
}