[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See
Storage Client Library for the latest version.]
Returns an access condition such that an operation will be performed only if the resource's ETag value matches the ETag value provided.
Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)
Usage
Visual Basic |
---|
Dim etag As String
Dim returnValue As AccessCondition
returnValue = AccessCondition.IfMatch(etag) |
Syntax
Visual Basic |
---|
Public Shared Function IfMatch ( _
etag As String _
) As AccessCondition |
C# |
---|
public static AccessCondition IfMatch (
string etag
) |
C++ |
---|
public:
static AccessCondition IfMatch (
String^ etag
) |
Parameters
- etag
The ETag value to check.
Return Value
A structure specifying the
If-Match condition.
Example
The following example deletes a blob if its ETag matches a specified value.
| Copy Code |
---|
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);
}
|
Remarks
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Change History
See Also