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))
{
}
Computer Electronics professional, Software Architect and senior Windows C++ and C# developer with experience in many other programming languages, platforms and application areas including communications, simulation systems, PACS/DICOM (radiology), GIS, 3D graphics and HTML5-based web applications.
Currently intensively working with Visual Studio and TFS.