title: StackExchange.Redis Transaction
body: <p>How can I run two asynchronous methods in one transaction?</p>
  
  <p>For example:</p>
  
  <pre><code>  var batchIds = new ConcurrentBag&lt;int&gt;();
    var trans = redis.CreateTransaction();
  
    var task = trans.ListRangeAsync(AllItems, 0L, batchSize - 1).ContinueWith(t =&gt;
     {
      t?.Result.ToList().ForEach(x =&gt; batchIds.Add(JsonConvert.DeserializeObject&lt;StockItemDto&gt;(x).Id));
       }).ContinueWith(t=&gt;{ trans.ListTrimAsync(AllItems, batchSize, -1); });  // This not work
  
    // This work but I'm not sure if taskRemove run exaclly after task
    var taskRemove = trans.ListTrimAsync(AllItems, batchSize, -1);                    
    trans.Execute(CommandFlags.FireAndForget);
    Task.WaitAll(task, taskRemove);
  </code></pre>
  
  <p>Maybe someone knows how to get a range from list and later remove this range in transaction?</p>