title: How to throttle event stream using RX?
body: <p>I want to effectively throttle an event stream, so that my delegate is called when the first event is received but then not for 1 second if subsequent events are received. After expiry of that timeout (1 second), if a subsequent event was received I want my delegate to be called.</p>
  
  <p>Is there a simple way to do this using Reactive Extensions?</p>
  
  <p>Sample code:</p>
  
  <pre><code>static void Main(string[] args)
  {
      Console.WriteLine("Running...");
  
      var generator = Observable
          .GenerateWithTime(1, x =&gt; x &lt;= 100, x =&gt; x, x =&gt; TimeSpan.FromMilliseconds(1), x =&gt; x + 1)
          .Timestamp();
  
      var builder = new StringBuilder();
  
      generator
          .Sample(TimeSpan.FromSeconds(1))
          .Finally(() =&gt; Console.WriteLine(builder.ToString()))
          .Subscribe(feed =&gt;
                     builder.AppendLine(string.Format("Observed {0:000}, generated at {1}, observed at {2}",
                                                      feed.Value,
                                                      feed.Timestamp.ToString("mm:ss.fff"),
                                                      DateTime.Now.ToString("mm:ss.fff"))));
  
      Console.ReadKey();
  }
  </code></pre>
  
  <p>Current output:</p>
  
  <pre><code>Running...
  Observed 064, generated at 41:43.602, observed at 41:43.602
  Observed 100, generated at 41:44.165, observed at 41:44.602
  </code></pre>
  
  <p>But I want to observe (timestamps obviously will change)</p>
  
  <pre><code>Running...
  Observed 001, generated at 41:43.602, observed at 41:43.602
  ....
  Observed 100, generated at 41:44.165, observed at 41:44.602
  </code></pre>