本文整理汇总了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;
}