private static void DoLeaseOperation(CloudBlob blob, string leaseId, LeaseAction action) { switch (action) { case LeaseAction.Acquire: blob.AcquireLeaseAsync(TimeSpan.FromSeconds(90), leaseId).Wait(); break; case LeaseAction.Renew: blob.RenewLeaseAsync(AccessCondition.GenerateLeaseCondition(leaseId)).Wait(); break; case LeaseAction.Release: blob.ReleaseLeaseAsync(AccessCondition.GenerateLeaseCondition(leaseId)).Wait(); break; case LeaseAction.Break: blob.BreakLeaseAsync(TimeSpan.FromSeconds(90)).Wait(); break; case LeaseAction.Change: blob.ChangeLeaseAsync(leaseId, AccessCondition.GenerateLeaseCondition(leaseId)).Wait(); break; default: throw new ArgumentOutOfRangeException(nameof(action), action, null); } }