title: How important is it to use a variable for DateTime.Today when concerned about performance?
body: <p>I just saw <a href="https://stackoverflow.com/questions/591752/get-the-previous-months-first-and-last-day-dates-in-c-sharp#comment403897_591820">this upvoted comment</a></p>
  
  <blockquote>
    <p>IIRC <code>DateTime.Today</code> is a quite expensive call, so you better store the value in a variable first.</p>
  </blockquote>
  
  <p>It was in response to a post that contained the code:</p>
  
  <pre><code>var first = 
      new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(-1);
  var last = 
      new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddDays(-1);
  </code></pre>
  
  <p>If I am looking to improve performance, how important is it to store <code>DateTime.Today</code> in a variable instead of calling it multiple times? And roughly how many uses of <code>DateTime.Today</code> would justify creating a variable for it?</p>
  
  <p><strong>Edit:</strong> I realize I should test my program to see if there are performance problems first before worrying about something as trivial as this. For the sake of this question, assume that I have already done this and determined that additional optimization is needed.</p>