I have seen many code snippets like:
frm.ShowDialog();
if (frm.DialogResult.HasValue && frm.DialogResult.Value)
{
}
or
DialogResult result = frm.ShowDialog();
if (result.HasValue && result.Value)
{
}
This double check is done because
DialogResult
is of nullable type:
bool?
, but evaluation can be as simple as:
frm.ShowDialog();
if (frm.DialogResult.Equals(true))
{
}