title: DateTime.Min Value when string equals EmptyOr Null in Linq to XML
body: <p>I am attempting to parse an xml string that has dates in there.  The object that I am trying to fill has a nullable DateTime.  But if the string that I pull back has an empty value, I want it to be the min Date Value.  and I want to assign that to the variable?  Is there a simple way to do that using LINQ</p>
  
  <pre><code> IEnumerable&lt;PatientClass&gt; template = (IEnumerable&lt;PatientClass&gt;)(from templates in xDocument.Descendants("dataTemplateSpecification")//elem.XPathSelectElements(string.Format("//templates/template[./elements/element[@name=\"PopulationPatientID\"and @value='{0}' and @enc='{1}']]", "1", 0))
                                                 select new PatientClass
                                                 {
   PCPAppointmentDateTime = DateTime.Parse(templates.Descendants("element").SingleOrDefault(el =&gt; el.Attribute("name").Value == "PCPAppointmentDateTime").Attribute("value").Value),
   });
  </code></pre>
  
  <p>The object that I am using is this...</p>
  
  <pre><code> class PatientClass
   { 
     public DateTime? PCPAppointmentDateTime { get; set; }
   }
  </code></pre>
  
  <p>Any ideas?</p>