title: In C# how do I initiate a method to run postponed with ability to postpone further?
body: <p>I need to run a delayed method in my code the way so that I could further control that &quot;postponed method&quot; (i.e. postpone it even more).</p>
  <p>More specifically, I am doing this when reading data from serial port to ensure that the data has stopped flowing in. The data that I receive is rather unspecific so I can't rely on its length or some termination symbol. Instead, I want to use the DataReceived handler as usual and inside initiate the &quot;process data&quot; method as postponed for 200ms or so - but to postpone it again and again if further DataReceived handlers are firing.</p>
  <p>So basically, my code would need to go something like this:</p>
  <pre><code>private string _serialPortCurrentReceivedDataBuffered = null;
  
  private void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
  {
      string receivedData = ((SerialPort)sender).ReadExisting();
  
      if (_serialPortCurrentReceivedDataBuffered == null)
      {
          _serialPortCurrentReceivedDataBuffered = receivedData;
      }
      else
      {
          _serialPortCurrentReceivedDataBuffered += receivedData;
      }
  
      &lt;THAT POSTPONED METHOD&gt;.SetStartToTime(DateTime.Now.AddMilliseconds(200));
  }
  
  private &lt;THAT POSTPONED METHOD&gt;()
  {
      string receivedData = _serialPortCurrentReceivedDataBuffered;
      _serialPortCurrentReceivedDataBuffered = null;
      
      &lt;HANDLE RECEIVED DATA&gt;
  }
  </code></pre>
  <p>Is there a way to do so? I am working with .NET Framework 4.7.2.</p>
  <p>Also, inside &lt;THAT POSTPONED METHOD&gt; I will need to manipulate the UI (WinForms), if that's of any consideration in this case.</p>
  <p>Thanks in advance!</p>