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


C# System.Collections.Generic.OrderByDescending方法代码示例

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


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

示例1: Must_result_in_zero

			public void Must_result_in_zero()
			{
				const string sql = "sql";
				IEnumerable<DbParameter> parameters = new[]
					{
						new SqlParameter("@Test1", 0),
						new SqlParameter("@Test2", "Test"),
						new SqlParameter("@Test3", 1.45m)
					};

				var cacheKey1 = new CacheKey(sql, parameters);
				var cacheKey2 = new CacheKey(sql, parameters.OrderByDescending(arg => arg.ParameterName));
				int result = Comparer<CacheKey>.Default.Compare(cacheKey1, cacheKey2);

				Assert.That(result, Is.EqualTo(0));
			}
开发者ID:nathan-alden,项目名称:junior-persist,代码行数:16,代码来源:CacheKeyTester.cs

示例2: ShouldDetectTheHighestStraight

        public void ShouldDetectTheHighestStraight()
        {
            var cards = new[] {
                                  3.Of(Suit.Hearts),
                                  4.Of(Suit.Spades),
                                  5.Of(Suit.Clubs),
                                  6.Of(Suit.Diamonds),
                                  7.Of(Suit.Spades),
                                  8.Of(Suit.Clubs),
                                  9.Of(Suit.Hearts)
                              };

            IEnumerable<Card> result = new Straight().Match(cards);

            Assert.That( result, Is.EquivalentTo(cards.OrderByDescending( x=>x.Rank).Take(5)), "Should have matched the highest straight.");
        }
开发者ID:dansweeting,项目名称:Pokr,代码行数:16,代码来源:StraightPatternTests.cs

示例3: ShouldMatchHighestCards

        public void ShouldMatchHighestCards()
        {
            var cards = new[]
                            {
                                Picture.Ace.Of(Suit.Clubs),     //
                                Picture.King.Of(Suit.Clubs),    //
                                Picture.Queen.Of(Suit.Clubs),   //
                                Picture.Jack.Of(Suit.Clubs),    //
                                10.Of(Suit.Clubs),              //
                                9.Of(Suit.Clubs),
                                2.Of(Suit.Hearts)
                            };

            IEnumerable<Card> result = new StraightFlush().Match(cards);

            Assert.That( result, Is.EquivalentTo( cards.OrderByDescending( x => x.Rank).Take(5)),
                "Should have matched the highest straight flush.");
        }
开发者ID:dansweeting,项目名称:Pokr,代码行数:18,代码来源:StraightFlushPatternTests.cs

示例4: Test_Order

		public void Test_Order()
		{
			var list = new[]
			{
				GetApplication(1, "1", 1, "1"),
				GetApplication(2, "1", 3, "1"),
				GetApplication(3, "1", 5, "0"),
				GetApplication(4, "1", 4, "0"),
				GetApplication(5, "0", 2, "0")
			}.AsQueryable();

			var expected = list
				.OrderByDescending(x => x.State.Name)
				.ThenByDescending(x => x.Id)
				.ThenBy(x => x.AirWaybill.Bill).ToArray();

			var orders = new[]
			{
				new Order
				{
					OrderType = OrderType.State,
					Desc = true
				},
				new Order
				{
					OrderType = OrderType.Id,
					Desc = true
				},
				new Order
				{
					OrderType = OrderType.AirWaybill,
					Desc = false
				}
			};

			var actual = _orderer.Order(list, orders).ToArray();

			for(var i = 0; i < orders.Length; i++)
			{
				Assert.AreSame(expected[i], actual[i]);
			}
		}
开发者ID:UHgEHEP,项目名称:test,代码行数:42,代码来源:ApplicationRepositoryOrdererTests.cs

示例5: ShouldDetectTheHighestFlush

        public void ShouldDetectTheHighestFlush()
        {
            var cards = new[]
                            {
                                Picture.Ace.Of(Suit.Spades),
                                2.Of(Suit.Spades),
                                3.Of(Suit.Spades),
                                5.Of(Suit.Spades),
                                7.Of(Suit.Spades),
                                9.Of(Suit.Spades),
                                10.Of(Suit.Spades)
                            };

            IEnumerable<Card> result = new Flush().Match(cards);

            Assert.That(result.Count(), Is.EqualTo(5));
            Assert.That(result.All(x => x.Suit == Suit.Spades), Is.True, "Should contain the flush only.");

            Assert.That(result, Is.EquivalentTo(cards.OrderByDescending(x => x.Rank).Take(5)),
                "Should have picked the highest spade cards.");
        }
开发者ID:dansweeting,项目名称:Pokr,代码行数:21,代码来源:FlushPatternTests.cs


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