title: Copy blobs between storage containers in Azure using C#
body: <p>I wrote the following C# code for copying blobs between storage containers in Azure. It doesnt throw any error, but it doesnt give the output either. </p>
  
  <pre><code>static void TransferBlob(string accountName, string accountKey, string containerName, string targetContainerName)
  
      {
          CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
          CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
          CloudBlobContainer sourceContainer = cloudBlobClient.GetContainerReference(containerName);
          CloudBlobContainer targetContainer = cloudBlobClient.GetContainerReference(targetContainerName);
          CloudBlockBlob sourceBlob;
          CloudBlockBlob targetBlob;
          foreach (var blobItem in sourceContainer.ListBlobs())
          {
              sourceBlob = sourceContainer.GetBlockBlobReference(blobItem.Uri.ToString());
              targetBlob = targetContainer.GetBlockBlobReference(blobItem.Uri.ToString());
              targetBlob.StartCopy(sourceBlob);
          }
      }
  </code></pre>