private void btnWriteHashes_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { var hashes = new HashCollection(); var files = Directory.GetFiles(txtImageFolder.Text); foreach (var file in files) { int[] hash; using (Bitmap bmp = new Bitmap(file)) { hash = bmp.GetHash(_scaleSize); } hashes.Add(new HashEntry { Filename = file, Hash = hash }); } hashes.Write(saveFileDialog.FileName); } }