Like others said.
Here it's "consolidated":
bool? dialogResult = _openFileDialog.ShowDialog();
if (dialogResult.HasValue && dialogResult.Value)
{
FilePath.Text = _openFileDialog.File.FullName;
string[] allLines = File.ReadAllLines(FilePath.Text);
fileContents.Text = string.Join("\n", allLines);
enableVerifyButton();
if (allLines.Length > allLines.Distinct.Count)
{
duplicate.Text = "Duplicate Entries Found";
}
else
{
duplicate.Text = "No Duplicates Found";
}
enableClearButton();
}
This may not be
optimal but it
ought to be faster.
Do you really need the contents in the
fileContents.Text
control?
This requires building the
big string.