本文整理汇总了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;
}
}
示例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)));
}
示例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;
}
示例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;
}
示例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();
}
示例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
);
}
示例7: IsCardEffectPlayedForTeam
private bool IsCardEffectPlayedForTeam(
IOrderedEnumerable<Tuple<PlayCardEvent, Card>> cardsPlayedOnTeam,
EffectCardType effect)
{
return cardsPlayedOnTeam
.Any(x => x.Item2.EffectType.HasFlag(effect));
}
示例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);
}
示例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");
}
}
示例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;
}