title: Only execute method after X number of seconds since last use
body: <p>I have a foreach statement, and I need to make it so that a method called at the end of the foreach and if statements only executes after 3 seconds from it's last execution time.</p>
  
  <p>Here's the code.</p>
  
  <pre><code>  //Go over Array for each id in allItems
    foreach (int id in allItems)
              {
                  if (offered &gt; 0 &amp;&amp; itemsAdded != (offered * 3) &amp;&amp; tDown)
                  {
                      List&lt;Inventory.Item&gt; items = Trade.MyInventory.GetItemsByDefindex(id);
                      foreach (Inventory.Item item in items)
                      {
                          if (!Trade.myOfferedItems.ContainsValue(item.Id))
                          {
                              //Code to only execute if x seconds have passed since it last executed.
                              if (Trade.AddItem(item.Id))
                              {
                                  itemsAdded++;
                                  break;
                              }
                              //end code delay execution 
                          }
                      }
                  }
              }
  </code></pre>
  
  <p>And I don't want to Sleep it, since when an item is added, I need to get confirmation from the server that the item has been added.</p>