title: Getting the value of a Nullable Boolean using Reflection
body: <p>I'm trying to the value of a nullable boolean using reflection. The values are coming from a DB so I have to keep them the same. </p>
  
  <p>Here is the code I am using.</p>
  
  <pre><code>public partial class PrinterConfigUC : UserControl
  {
      prtsetup Printer { get; set; }
  
      public PrinterConfigUC(prtsetup printer)
      {
          InitializeComponent();
          this.Printer = printer;
          lblPrinterName.Text = Printer.prtname;
  
          var properties = printer.GetType().GetProperties();          
  
          foreach (var prop in properties)
          {
              //In debug, a nullable bool had a type name of "Nullable`1"
              if (prop.PropertyType.Name.Equals("Nullable`1"))
              {
                  bool? tempBool = (bool?)prop.GetValue(prop, null);
              }
          }
      }
  </code></pre>
  
  <p>If I put a break point at <code>bool? tempBool = (bool?)prop.GetValue(prop, null);</code> and execute the line, the program stops further execution and just shows me a blank winform.  Nothing else happens. There are no error messages and the program doesn't crash, it just hangs on that one line.</p>