本文整理匯總了C#中System.UriBuilder.PathAppend方法的典型用法代碼示例。如果您正苦於以下問題:C# UriBuilder.PathAppend方法的具體用法?C# UriBuilder.PathAppend怎麽用?C# UriBuilder.PathAppend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.UriBuilder
的用法示例。
在下文中一共展示了UriBuilder.PathAppend方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateUri3_append_relative_path_2
public void CreateUri3_append_relative_path_2()
{
var builder = new UriBuilder("foo.com")
{
Scheme = "https",
Port = 4321,
Path = "/a"
};
Assert.AreEqual("/a", builder.Path);
builder.PathAppend("/////somepath/somefile.htm");
Assert.AreEqual("https://foo.com:4321/a/somepath/somefile.htm", builder.Uri.AbsoluteUri);
}
示例2: CombineUris
public static string CombineUris(this string uri, string relativePathToAppend)
{
var builder = new UriBuilder(uri);
builder.PathAppend(relativePathToAppend);
return builder.Uri.AbsoluteUri;
}
示例3: Add_slash_only_adds_slash_and_append_works
public void Add_slash_only_adds_slash_and_append_works()
{
var builder = new UriBuilder("foo.com")
{
Path = "a"
};
builder.Path += "/";
builder.PathAppend("b/");
Assert.AreEqual("http://foo.com/a/b/", builder.Uri.AbsoluteUri);
}