本文整理匯總了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);
}