銷售: 1-800-867-1380

AccessCondition.IfMatch 方法

Returns an access condition such that an operation will be performed only if the resource's ETag value matches the ETag value provided.

命名空間: Microsoft.WindowsAzure.StorageClient
組件: Microsoft.WindowsAzure.StorageClient (在 microsoft.windowsazure.storageclient.dll 中)

'用途
Dim etag As String
Dim returnValue As AccessCondition

returnValue = AccessCondition.IfMatch(etag)

public static AccessCondition IfMatch (
	string etag
)
public static AccessCondition IfMatch (
	String etag
)
public static function IfMatch (
	etag : String
) : AccessCondition

參數

etag

The ETag value to check.

傳回值

A structure specifying the If-Match condition.

The following example deletes a blob if its ETag matches a specified value.

static void DeleteIfMatch(Uri blobEndpoint, string accountName, string accountKey, string eTag)
{
    CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));

    //Get a reference to the blob.
    CloudBlob blob = blobClient.GetBlobReference("mycontainer/myblob.txt");

    //Indicate that any snapshots should be deleted.
    BlobRequestOptions options = new BlobRequestOptions();
    options.DeleteSnapshotsOption = DeleteSnapshotsOption.IncludeSnapshots;

    //Specify the if-match condition. The blob will be deleted if its ETag matches the value passed in.
    options.AccessCondition = AccessCondition.IfMatch(eTag);

    //Delete the blob if the condition is met.
    blob.Delete(options);
}


Setting this access condition modifies the request to include the HTTP If-Match conditional header.

If this access condition is set, the operation is performed only if the ETag of the resource matches the specified ETag.

See Specifying Conditional Headers for Blob Service Operations for more information.


任何這個類型的公用靜態 (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。 並非所有的執行個體成員都是安全執行緒。

開發平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目標平台

本文對您有任何幫助嗎?
(剩餘 1500 個字元)
感謝您提供意見

社群新增項目

顯示:
© 2014 Microsoft