title: Nullable datetime value
body: <p>Can a <code>DateTime</code> value be <code>NULL</code>? </p>
  
  <p>I have this code:</p>
  
  <p>From here I inherit my variable </p>
  
  <pre><code>namespace Transakcija
  {
       public class Line
       {
          public System.DateTime DateOfProduction { get; set; }
       }
  }
  </code></pre>
  
  <p>Then for each loop:</p>
  
  <pre><code>foreach (var rw_det in dt_stavke.Rows)
  {
      var list = new List&lt;Transakcija.Line&gt;();
      var l = new Transakcija.Line();
  
       //DateOfProduction
      if (rw_det["DPRO02"].ToString().Length &lt;= 0)
      {
          l.DateOfProduction = default(DateTime);
      }
      else
      {
          l.DateOfProduction = new DateTime();
          prod_date = rw_det["DPRO02"].ToString();
          DateTime pro_date = DateTime.ParseExact(prod_date, "dd.MM.yyyy", CultureInfo.InvariantCulture);
          string p_date = pro_date.ToString("yyyy-MM-dd");
          l.DateOfProduction = DateTime.Parse(p_date);
      }
  }
  </code></pre>
  
  <p>So the value <code>l.DateOfProduction</code> needs to be null.  I have tried this:</p>
  
  <pre><code>DateTime? dt = null;
  l.DateOfProduction = (DateTime)dt;
  </code></pre>
  
  <p>But I got error: <code>nullable object must have a value</code></p>
  
  <p>So is this possible or do I have to pass the minimum <code>datetime</code> value to the variable?</p>