本文整理匯總了C#中System.Uri.StoragePartitionName方法的典型用法代碼示例。如果您正苦於以下問題:C# Uri.StoragePartitionName方法的具體用法?C# Uri.StoragePartitionName怎麽用?C# Uri.StoragePartitionName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Uri
的用法示例。
在下文中一共展示了Uri.StoragePartitionName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UriParser_ParsingWellFormedMinimalLocalStoragePartitionName_Succeeds
public void UriParser_ParsingWellFormedMinimalLocalStoragePartitionName_Succeeds()
{
var expected = "partition";
var url = "http://127.0.0.1:10000/account-name/partition";
var uri = new Uri(url);
Assert.AreEqual(expected, uri.StoragePartitionName());
}
示例2: UriParser_ParsingWellFormedComplexCloudStoragePartitionName_Succeeds
public void UriParser_ParsingWellFormedComplexCloudStoragePartitionName_Succeeds()
{
var expected = "partition";
var url = "http://accountname.queue.core.windows.net/partition/somethingelse?SomeQueryStringForNow";
var uri = new Uri(url);
Assert.AreEqual(expected, uri.StoragePartitionName());
}
示例3: GetBlobName
public static string GetBlobName(Uri uri)
{
string pathAndQuery = uri.PathAndQuery; // everything to the right of domain name
string blobNameAndQuery = pathAndQuery.Substring(uri.StoragePartitionName().Length + 2);
// blob name is after container...
// ... but don't include query string (if one is present) [note: query strings are ignored by Blob Storage]
// [http://blogs.msdn.com/b/windowsazure/archive/2011/03/18/best-practices-for-the-windows-azure-content-delivery-network.aspx]
// ["In blob storage origin, query strings are always ignored. In particular, shared access strings cannot be used to enable CDN access to a private container."]
string blobName = blobNameAndQuery.IndexOf('?') > 0
? blobNameAndQuery.Substring(0, blobNameAndQuery.IndexOf('?'))
: blobNameAndQuery;
return blobName;
}
示例4: ContainerNameIsLongEnough
public static bool ContainerNameIsLongEnough(Uri uri)
{
return uri.StoragePartitionName().Length >= MinLengthAzureBlobContainerName;
}