title: How to return named tuples in C#?
body: <p>I have a property that returns two items of type <code>DateTime</code>. When returning these values I have to reference them as <code>Item1</code> and <code>Item2</code>. How do I return with custom names e.g. </p>
  
  <pre><code>filter?.DateRanges.From
  filter?.DateRanges.To
  </code></pre>
  
  <p>&nbsp;</p>
  
  <pre><code>public Tuple&lt;DateTime, DateTime&gt; DateRanges
  {
      get
      {
          From = DateTime.Now.AddDays(-1).Date.AddMonths(-1);
          To = DateTime.Now.AddDays(-1).Date;
  
          if (Preset != 0)
          {
              if (Preset == DatePreset.SpecificRange)
              {
                  From = From.Date;
                  To = To.Date;
              }
              else
              {
                  var dateRange = DateTime.Today.AddDays(-1).GetDateRangeByPreset(Preset);
                  From = dateRange.From;
                  To = dateRange.To;
              }
          }
  
          return new Tuple&lt;DateTime, DateTime&gt;(From, To);
      }
  </code></pre>
  
  <p>usage:</p>
  
  <pre><code>var from = filter?.DateRanges.Item1;
  var to = filter?.DateRanges.Item2;
  </code></pre>