当前位置: 首页>>代码示例>>C#>>正文


C# QueryString.Remove方法代码示例

本文整理汇总了C#中QueryString.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# QueryString.Remove方法的具体用法?C# QueryString.Remove怎么用?C# QueryString.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryString的用法示例。


在下文中一共展示了QueryString.Remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

        public ActionResult Process(HttpRequestBase request, ModelStateDictionary modelState)
        {
            IpnVerificationBinder binder = new IpnVerificationBinder();
            Transaction tx = binder.Bind(request.Form, modelState);

            ContentResult cr = new ContentResult();
            cr.ContentEncoding = Encoding.UTF8;
            cr.ContentType = "text/html";
            cr.Content = "INVALID";

            if (tx != null)
            {
                Transaction dbTx = m_txRepository.GetAll().Where(x => x.Tx == tx.Tx).FirstOrDefault();
                if (dbTx != null)
                {
                    string expected = dbTx.ToIpnQueryString().ToString();
                    QueryString actualQs = new QueryString();
                    actualQs.Add(request.Form);
                    actualQs.Remove("cmd");
                    string actual = actualQs.ToString();

                    if (expected == actual)
                    {
                        cr.Content = "VERIFIED";
                    }
                }
            }

            return cr;
        }
开发者ID:triggerfish,项目名称:PayPalEmulator,代码行数:30,代码来源:AuthoriseIpnHandler.cs

示例2: 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());
        }
开发者ID:WindowsNotifications,项目名称:QueryString.NET,代码行数:47,代码来源:QueryStringTest.cs

示例3: TestRemoveWithValue_MultipleKeys

        public void TestRemoveWithValue_MultipleKeys()
        {
            QueryString qs = new QueryString()
            {
                { "name", "Andrew" },
                { "name", "Lei" }, // to be removed
                { "name", "Thomas" },
                { "name", "Lei" },
                { "age", "22" }
            };

            Assert.IsFalse(qs.Remove("name", null));
            Assert.IsFalse(qs.Remove("name", "andrew"));
            Assert.IsFalse(qs.Remove("name", "Matt"));
            Assert.IsTrue(qs.Remove("name", "Lei"));

            AssertEqual(new QueryString()
            {
                { "name", "Andrew" }, // to be removed
                { "name", "Thomas" },
                { "name", "Lei" },
                { "age", "22" }
            }, qs);

            Assert.IsTrue(qs.Remove("name", "Andrew"));

            AssertEqual(new QueryString()
            {
                { "name", "Thomas" },
                { "name", "Lei" }, // to be removed
                { "age", "22" }
            }, qs);

            Assert.IsFalse(qs.Remove("name", "Andrew"));
            Assert.IsTrue(qs.Remove("name", "Lei"));

            AssertEqual(new QueryString()
            {
                { "name", "Thomas" },
                { "age", "22" }
            }, qs);

            Assert.IsFalse(qs.Remove("name", "Lei"));
        }
开发者ID:WindowsNotifications,项目名称:QueryString.NET,代码行数:44,代码来源:QueryStringTest.cs

示例4: TestRemove_TwoKeys

        public void TestRemove_TwoKeys()
        {
            QueryString qs = new QueryString()
            {
                { "name", "Andrew" },
                { "age", "22" },
                { "age", "23" }
            };

            Assert.IsTrue(qs.Remove("age"));

            AssertEqual(new QueryString()
            {
                { "name", "Andrew" },
                { "age", "23" }
            }, qs);

            Assert.IsTrue(qs.Remove("age"));

            AssertEqual(new QueryString()
            {
                { "name", "Andrew" }
            }, qs);

            Assert.IsFalse(qs.Remove("age"));
        }
开发者ID:WindowsNotifications,项目名称:QueryString.NET,代码行数:26,代码来源:QueryStringTest.cs

示例5: TestRemoveWithValue_OnlyKey

        public void TestRemoveWithValue_OnlyKey()
        {
            QueryString qs = new QueryString()
            {
                { "name", "Andrew" },
                { "age", "22" }
            };

            Assert.IsFalse(qs.Remove("age", null));
            Assert.IsFalse(qs.Remove("age", "21"));
            Assert.IsTrue(qs.Remove("age", "22"));

            AssertEqual(new QueryString()
            {
                { "name", "Andrew" }
            }, qs);

            Assert.IsFalse(qs.Remove("age", "22"));
        }
开发者ID:WindowsNotifications,项目名称:QueryString.NET,代码行数:19,代码来源:QueryStringTest.cs


注:本文中的QueryString.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。