public static string DownloadTextAPM(CloudBlob blob, Encoding encoding, AccessCondition accessCondition = null, BlobRequestOptions options = null, OperationContext operationContext = null) { using (MemoryStream stream = new MemoryStream()) { using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result = blob.BeginDownloadToStream(stream, accessCondition, options, operationContext, ar => waitHandle.Set(), null); waitHandle.WaitOne(); blob.EndDownloadToStream(result); return(encoding.GetString(stream.ToArray())); } } }
public static string DownloadTextAPM(CloudBlob blob, Encoding encoding, AccessCondition accessCondition = null, BlobRequestOptions options = null, OperationContext operationContext = null) { using (MemoryStream stream = new MemoryStream()) { using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result = blob.BeginDownloadToStream(stream, accessCondition, options, operationContext, ar => waitHandle.Set(), null); waitHandle.WaitOne(); blob.EndDownloadToStream(result); return encoding.GetString(stream.ToArray()); } } }