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


C# IOrderedEnumerable.Any方法代码示例

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


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

示例1: DisplayPackageViewModel

        public DisplayPackageViewModel(Package package, IOrderedEnumerable<Package> packageHistory, bool isVersionHistory)
            : base(package)
        {
            Copyright = package.Copyright;

            if (!isVersionHistory)
            {
                Dependencies = new DependencySetsViewModel(package.Dependencies);
                PackageVersions = packageHistory.Select(p => new DisplayPackageViewModel(p, packageHistory, isVersionHistory: true));
            }

            DownloadCount = package.DownloadCount;
            LastEdited = package.LastEdited;

            if (!isVersionHistory && packageHistory.Any())
            {
                // calculate the number of days since the package registration was created
                // round to the nearest integer, with a min value of 1
                // divide the total download count by this number
                TotalDaysSinceCreated = Convert.ToInt32(Math.Max(1, Math.Round((DateTime.UtcNow - packageHistory.Last().Created).TotalDays)));
                DownloadsPerDay = TotalDownloadCount / TotalDaysSinceCreated; // for the package
            }
            else
            {
                TotalDaysSinceCreated = 0;
                DownloadsPerDay = 0;
            }
        }
开发者ID:ZhiYuanHuang,项目名称:NuGetGallery,代码行数:28,代码来源:DisplayPackageViewModel.cs

示例2: MeansOfTransportAsString

        public string MeansOfTransportAsString(IOrderedEnumerable<TransportMethod> meansOfTransport)
        {
            if (meansOfTransport == null || !meansOfTransport.Any())
            {
                return string.Empty;
            }

            return string.Join("-", meansOfTransport.Select(m => EnumHelper.GetShortName(m)));
        }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:9,代码来源:MeansOfTransportFormatter.cs

示例3: AbsentEventCreation

        private static bool AbsentEventCreation(TimeBox sender, Term absent, IOrderedEnumerable<Term> orderedTerms)
        {
            if (orderedTerms.Any(t => t.CanNotOverlapWithAbsent && t.OverlapNotEnclosed(absent))) 
                return false;

            var exists = orderedTerms.Where(absent.NeedRelyOn)
                                     .Any(t =>
                                     {
                                         if (t.EnclosedWithTypeVerification(absent))
                                         {
                                             absent.Bottom = t.GetLowestTerm() as Term;
                                         
                                             //if (absent.IsNeedSeat != t.IsNeedSeat && t is AssignmentBase)
                                             //    ((AssignmentBase)t).CancelSeatArrangement(absent);

                                             return true;
                                         }
                                         return false;
                                     });
            return exists;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:21,代码来源:TimeBox.Validation.cs

示例4: IndependenceTermCreation

        private static bool IndependenceTermCreation(TimeBox sender, Term other, IOrderedEnumerable<Term> orderedTerms)
        {
            //bugs might be here
            var result = !orderedTerms.Any(t =>  {
                var found = false;
                if (t.Level > other.Level)
                {
                    found = other.OverlapNotEnclosed(t);
                    other.Exception = new TermException(t, "OverlapNotEnclosed");
                }//upper term

                

                if (t.Level == other.Level && !(t is IOffWork || other is IOffWork) && t.HrDateEq(other)) // 只有非IOffWork不可相交
                {
                    found = t.IsCoverd(other);
                    other.Exception = new TermException(t, "IsCoverd");
                }// same level term

                return found;
            });

            return result;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:24,代码来源:TimeBox.Validation.cs

示例5: GetCardsForTrade

        private decimal GetCardsForTrade(decimal actualValue, IOrderedEnumerable<MagicCard> purchaseCards, decimal runningValue)
        {
            var cardsSelected = new Dictionary<int, MagicCard>();
            var remainingCount = TheirCollection.ToList.Count(p => p.CopiesOfCard > 0);

            while (cardsSelected.Values.Sum(p => p.CopiesOfCard * p.BuyPrice) < actualValue && remainingCount > 0)
            {
                var card = GetCard(purchaseCards.ToList(), cardsSelected);
                _logger.Trace("Selecting Card: " + card);

                runningValue -= card.BuyPrice;
                purchaseCards = TheirCollection.ToList.Where(p => p.BuyPrice < runningValue && p.CopiesOfCard > 0).OrderByDescending(p => p.BuyPrice);
                remainingCount = TheirCollection.ToList.Count(p => p.CopiesOfCard > 0);

                while (!purchaseCards.Any() && remainingCount > 0 && purchaseCards.Sum(p => p.BuyPrice*p.CopiesOfCard) < runningValue)
                {
                    runningValue += (decimal) .10;
                    purchaseCards = TheirCollection.ToList.Where(p => p.BuyPrice < runningValue && p.CopiesOfCard > 0).OrderByDescending(p => p.BuyPrice);
                }
            }

            MagicOnlineInterface.WriteWishListFile(cardsSelected);
            MagicOnlineInterface.LoadWishList();

            AutoItX.Sleep(5000);
            MagicOnlineInterface.DetermineYouGetAmount();

            if (MagicOnlineInterface.YouGetAmount != CardsYouGet.CountOfCards())
            {
                PopulateCardsYouGet();
            }

            return CardsYouGiveAmount - Credit - CardsYouGet.BuySum();
        }
开发者ID:jelgee-daptiv,项目名称:MTGO_Automated_Trader,代码行数:34,代码来源:RareTrader.cs

示例6: IsInvincibleCardEffectPlayedForTeam

 private bool IsInvincibleCardEffectPlayedForTeam(
     IOrderedEnumerable<Tuple<PlayCardEvent, Card>> cardsPlayedOnTeam,
     EffectCardType effect)
 {
     return cardsPlayedOnTeam
         .Any(x => x.Item2.EffectType.HasFlag(effect) &&
             x.Item2.CardType == CardType.EFFECT_INVINCIBLE
         );
 }
开发者ID:mrtryhard,项目名称:millebornes,代码行数:9,代码来源:GameService.cs

示例7: IsCardEffectPlayedForTeam

 private bool IsCardEffectPlayedForTeam(
     IOrderedEnumerable<Tuple<PlayCardEvent, Card>> cardsPlayedOnTeam,
     EffectCardType effect)
 {
     return cardsPlayedOnTeam
         .Any(x => x.Item2.EffectType.HasFlag(effect));
 }
开发者ID:mrtryhard,项目名称:millebornes,代码行数:7,代码来源:GameService.cs

示例8: OrderProduct

		private static OrderLine OrderProduct(int productId, IOrderedEnumerable<int> variants, int itemCount, OrderInfo order)
		{
			var currentLocalization = StoreHelper.CurrentLocalization;
			var productService = IO.Container.Resolve<IProductService>();
			var productInfo = productService.CreateProductInfoByProductId(productId, order, currentLocalization, itemCount);
			if (variants != null && variants.Any())
			{
				var productVariantService = IO.Container.Resolve<IProductVariantService>();
				var variantClasses = variants.Select(variant => productVariantService.GetById(variant, currentLocalization)).Where(variant => variant != null).GroupBy(a => a.Group).Select(g => g.FirstOrDefault()).Where(variant => variant != null);

				productInfo.ProductVariants = variantClasses.Select(variant => new ProductVariantInfo(variant, productInfo, itemCount)).ToList();
			}
			return new OrderLine(productInfo, order);
		}
开发者ID:Chuhukon,项目名称:uWebshop-Releases,代码行数:14,代码来源:OrderUpdatingService.cs

示例9: MostrarResultado

        private static void MostrarResultado(IOrderedEnumerable<Coche> resultado)
        {
            //Se puede comprobar si la lista que devuelve la búsqueda de linq
            //tiene elementos, o no, con el metodo .Any
            if (!resultado.Any())
            {
                foreach (var coche in resultado)
                {

                    Console.WriteLine(coche);

                }
            }
            else
            {
                Console.WriteLine("\n\nNo se han encontrado resultados.\n\n");
            }
        }
开发者ID:alejandrogf,项目名称:Practica_04_LinQ,代码行数:18,代码来源:Program.cs

示例10: ParseToHighChart

 public HighChart ParseToHighChart(IOrderedEnumerable<ScoreList> source)
 {
     var hiChart = new HighChart();
     if(source.Any())
     {
         hiChart.Name = source.First().Title;
         hiChart.Data = source.Select(s => ParseDateAndNumber(s.Date, s.Popular)).ToList();
     }
     return hiChart;
 }
开发者ID:died,项目名称:logs.died.tw,代码行数:10,代码来源:datacenter.ashx.cs


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