本文整理汇总了C#中System.Uri.AppendPath方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.AppendPath方法的具体用法?C# Uri.AppendPath怎么用?C# Uri.AppendPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Uri
的用法示例。
在下文中一共展示了Uri.AppendPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EtcdClient
public EtcdClient(Uri etcdLocation)
{
var uriBuilder = new UriBuilder(etcdLocation)
{
Path = ""
};
_root = uriBuilder.Uri;
_keysRoot = _root.AppendPath("v2").AppendPath("keys");
_client = new RestClient(_root.ToString());
}
示例2: AppendRelativeURLString
private static string AppendRelativeURLString(Uri remote, string relativePath)
{
var uri = remote.AppendPath(relativePath);
return uri.AbsoluteUri;
}
示例3: TestAppendPathURLString
public virtual void TestAppendPathURLString([Values("http://10.0.0.3:4984/connect-2014", "http://10.0.0.3:4984/connect-2014/")] String baseUri, [Values("/_bulk_get?revs=true&attachments=true", "_bulk_get?revs=true&attachments=true")] String newPath)
{
if (!Boolean.Parse((string)GetProperty("replicationTestsEnabled")))
{
Assert.Inconclusive("Replication tests disabled.");
return;
}
var dbUrlString = new Uri(baseUri);
var relativeUrlString = dbUrlString.AppendPath(newPath).AbsoluteUri;
var expected = "http://10.0.0.3:4984/connect-2014/_bulk_get?revs=true&attachments=true";
Assert.AreEqual(expected, relativeUrlString);
}
示例4: AppendRelativeURLString
private static string AppendRelativeURLString(Uri remote, string relativePath)
{
var uri = remote.AppendPath(relativePath);
return uri.AbsoluteUri;
// the following code is a band-aid for a system problem in the codebase
// where it is appending "relative paths" that start with a slash, eg:
// http://dotcom/db/ + /relpart == http://dotcom/db/relpart
// which is not compatible with the way the java url concatonation works.
// var remoteUrlString = remote.AbsolutePath;
// if (remoteUrlString.EndsWith ("/", StringComparison.Ordinal)
// && relativePath.StartsWith ("/", StringComparison.Ordinal))
// {
// remoteUrlString = remoteUrlString.Substring(0, remoteUrlString.Length - 1);
// }
// return remoteUrlString + relativePath;
}