本文整理汇总了C#中QueryString.Count方法的典型用法代码示例。如果您正苦于以下问题:C# QueryString.Count方法的具体用法?C# QueryString.Count怎么用?C# QueryString.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryString
的用法示例。
在下文中一共展示了QueryString.Count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseQueryString_001
public void ParseQueryString_001()
{
var QueryString = new QueryString("abc?a=b");
Assert.AreEqual(1, QueryString.Count());
Assert.AreEqual("a", QueryString.First().Key);
Assert.AreEqual("b", QueryString.First().Value.First());
}
示例2: ParseQueryString_002
public void ParseQueryString_002()
{
var QueryString = new QueryString("?a=b&a=c");
Assert.AreEqual(1, QueryString.Count());
Assert.AreEqual("a", QueryString.First().Key);
Assert.AreEqual("b", QueryString.First().Value.First());
Assert.AreEqual("c", QueryString.First().Value.Skip(1).First());
}
示例3: ParseQueryString_003
public void ParseQueryString_003()
{
var QueryString = new QueryString("a=b&c=d");
Assert.AreEqual(2, QueryString.Count());
Assert.AreEqual("a", QueryString.First().Key);
Assert.AreEqual("b", QueryString.First().Value.First());
Assert.AreEqual("c", QueryString.Skip(1).First().Key);
Assert.AreEqual("d", QueryString.Skip(1).First().Value.First());
}
示例4: TestCount
public void TestCount()
{
QueryString qs = new QueryString();
Assert.AreEqual(0, qs.Count());
qs.Add("name", "Andrew");
Assert.AreEqual(1, qs.Count());
qs.Add("age", "22");
Assert.AreEqual(2, qs.Count());
qs.Add("name", "Lei");
Assert.AreEqual(3, qs.Count());
qs.Set("name", "Thomas");
Assert.AreEqual(2, qs.Count());
qs.Add("name", "Matt");
Assert.AreEqual(3, qs.Count());
qs.Remove("name", "Matt");
Assert.AreEqual(2, qs.Count());
qs.Remove("name", "Thomas");
Assert.AreEqual(1, qs.Count());
qs.Remove("age");
Assert.AreEqual(0, qs.Count());
qs.Add("name", "Andrew");
qs.Add("name", "Lei");
Assert.AreEqual(2, qs.Count());
qs.RemoveAll("name");
Assert.AreEqual(0, qs.Count());
}
示例5: ParseQueryString_007
public void ParseQueryString_007()
{
var QueryString = new QueryString("a=b&");
Assert.AreEqual(1, QueryString.Count());
}
示例6: ParseQueryString_006
public void ParseQueryString_006()
{
var QueryString = new QueryString("&");
Assert.AreEqual(0, QueryString.Count());
}