本文整理汇总了C#中System.Uri.ExtendQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.ExtendQuery方法的具体用法?C# Uri.ExtendQuery怎么用?C# Uri.ExtendQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Uri
的用法示例。
在下文中一共展示了Uri.ExtendQuery方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCallbackUrl
/// <summary>
/// Retrieve call back URL
/// </summary>
/// <param name="panel"></param>
/// <returns></returns>
public static string GetCallbackUrl(this UpdatePanelScope panel)
{
var ctx = panel.Page.ActionContextsStack().Last();
var originalUrl = new Uri(ctx.HttpContext.Request.RawUrl, UriKind.Relative);
var url = originalUrl.ExtendQuery(new Dictionary<string, string> { { UpdatePanelUrlParameterName, panel.Id() } });
return url.ToString();
}
示例2: TestExtendQuery_empty_dictionary
public void TestExtendQuery_empty_dictionary()
{
var simpleUri = new Uri("http://dapplo.net");
var newUri = simpleUri.ExtendQuery(new Dictionary<string, string>());
Assert.NotNull(newUri);
Assert.Equal(simpleUri, newUri);
}
示例3: TestExtendQuery_WithDictionary_MultipleValuesInSource
public void TestExtendQuery_WithDictionary_MultipleValuesInSource()
{
var uri = new Uri(TestUriDuplicateValues);
uri = uri.ExtendQuery(new Dictionary<string, object>
{
{
Key, Value
}
});
Assert.AreEqual($"{TestUriDuplicateValues}&{Key}={Value}", uri.AbsoluteUri);
}
示例4: TestExtendQuery_WithDictionary
public void TestExtendQuery_WithDictionary()
{
var uri = new Uri(TestUriSingleValue);
uri = uri.ExtendQuery(new Dictionary<string, object>
{
{
Key, Value
}
});
Assert.AreEqual($"{TestUriSingleValue}&{Key}={Value}", uri.AbsoluteUri);
}
示例5: TestExtendQuery_WithNameValue
public void TestExtendQuery_WithNameValue()
{
var uri = new Uri(TestUriDuplicateValues);
uri = uri.ExtendQuery(Key, Value);
Assert.AreEqual($"{TestUriDuplicateValues}&{Key}={Value}", uri.AbsoluteUri);
}
示例6: TestExtendQuery_WithLookup_MultipleValuesInSource
public void TestExtendQuery_WithLookup_MultipleValuesInSource()
{
var uri = new Uri(TestUriDuplicateValues);
var testValues = new List<KeyValuePair<string, int>>
{
new KeyValuePair<string, int>(Key,Value),
new KeyValuePair<string, int>(Key,Value),
};
var lookup = testValues.ToLookup(x => x.Key, x => x.Value);
// Make sure we have one Key, which has multiple values
Assert.IsTrue(lookup.Count() == 1);
uri = uri.ExtendQuery(lookup);
Assert.AreEqual($"{TestUriDuplicateValues}&{Key}={Value}&{Key}={Value}", uri.AbsoluteUri);
}
示例7: TestExtendQuery_WithNameValue_EncodingNeeded
public void TestExtendQuery_WithNameValue_EncodingNeeded()
{
var uri = new Uri(TestUriDuplicateValues);
var uriValue = new Uri("http://jira/issue?otherval1=10&othervar2=20");
var encodedUri = Uri.EscapeDataString(uriValue.AbsoluteUri);
uri = uri.ExtendQuery("url", uriValue);
Assert.AreEqual($"{TestUriDuplicateValues}&url={encodedUri}", uri.AbsoluteUri);
}