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


C# IOrderedEnumerable.Last方法代码示例

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


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

示例1: Percentile

        private double Percentile(IOrderedEnumerable<double> sortedData, double p)
        {
            int count = sortedData.Count();
            if (count == 0) return 0;
            if (count == 1) return sortedData.Last();
            if (p >= 100.0d) return sortedData.Last();

            double position = (count + 1) * p / 100d;
            double leftNumber, rightNumber;

            double n = p / 100d * (count - 1) + 1d;

            if (position >= 1)
            {
                leftNumber = sortedData.ElementAt((int)Math.Floor(n) - 1);
                rightNumber = sortedData.ElementAt((int)Math.Floor(n));
            }
            else
            {
                leftNumber = sortedData.First();
                rightNumber = sortedData.ElementAt(1);
            }

            if (Math.Abs(leftNumber - rightNumber) < Double.Epsilon)
                return leftNumber;
            else
            {
                double part = n - Math.Floor(n);
                return leftNumber + part*(rightNumber - leftNumber);
            }
        }
开发者ID:demonix,项目名称:iPoint.ServiceStatistics,代码行数:31,代码来源:PercentileAggregationOperation.cs

示例2: 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

示例3: GetStatusColor

 private static object GetStatusColor(DateTime dateDue, IOrderedEnumerable<Data.Model.FollowUpStatus> statuses)
 {
     foreach (var status in statuses)
     {
         if ((dateDue.Date - DateTime.Today).TotalDays >= status.NumberOfDays)
         {
             return status.Color;
         }
     }
     return statuses.Last().Color;
 }
开发者ID:syatin003,项目名称:Wpf,代码行数:11,代码来源:DateDueToColorConverter.cs

示例4: AddCorners

 private void AddCorners(IOrderedEnumerable<Pixel> cornerCandidates)
 {
     if (cornerCandidates.Count() > 50)
     {
         //First and Last point are corners
         MassureAngleAndAddCorner(cornerCandidates.First());
         MassureAngleAndAddCorner(cornerCandidates.Last());
     }
     else
     {
         // middle point is corner
         int index = cornerCandidates.Count() / 2;
         MassureAngleAndAddCorner(cornerCandidates.ElementAt(index));
     }
 }
开发者ID:rerezz,项目名称:Digitale-Bildbearbeitung,代码行数:15,代码来源:ImageObject.cs

示例5: ArchiveInvocation

 private Task ArchiveInvocation(IOrderedEnumerable<InvocationState.InvocationRow> invocationHistory)
 {
     var latest = invocationHistory.Last();
     string name = String.Format(
             "{0}_{1}_{2}.json",
             latest.Job,
             latest.UpdatedAt.ToString("s"),
             latest.Id.ToString("N").ToLowerInvariant());
     return _archiveContainer.UploadJsonBlob(name, invocationHistory.ToArray());
 }
开发者ID:NuGet,项目名称:NuGet.Services.Work,代码行数:10,代码来源:InvocationQueue.cs


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