title: How can I get the retry count within a delegate executed through Polly retry policy?
body: <p>I'm implementing Polly to retry requests in my C# web app.  My sample code is included in this post.  The code works as expected but the last parameter passed to <code>CreateFile()</code> (currently hard-coded as 0) needs to be the value of <code>retryAttempt</code>. How can I get the value of <code>retryAttempt</code> within the <code>Execute</code>'s Action?</p>
  <pre><code>return Policy
      .Handle&lt;HttpException&gt;(x =&gt; x.StatusCode == (HttpStatusCode)429)
      .Or&lt;StorageException&gt;()
      .WaitAndRetry(maxRetryCount, retryAttempt =&gt; TimeSpan.FromMilliseconds(Math.Pow(retryIntervalMs, retryAttempt)))
      .Execute(() =&gt; CreateFile(fileContent, containerName, fileName, connectionString, 0));
  </code></pre>