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


C# ICollection.Max方法代码示例

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


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

示例1: Combine

 public static Region Combine(ICollection<Region> regions)
 {
     var start = regions.Min(x => x.Start);
     var end = regions.Max(x => x.End);
     var paddedEnd = regions.Max(x => x.PaddedEnd);
     return new Region(start, (int)(end - start), (int)(paddedEnd - start));
 }
开发者ID:GiGatR00n,项目名称:TeraDataTools,代码行数:7,代码来源:Region.cs

示例2: Combine

 public static DataCenterRegion Combine(ICollection<DataCenterRegion> regions)
 {
     var start = regions.Min(x => x.Start);
     var end = regions.Max(x => x.End);
     var paddedEnd = regions.Max(x => x.PaddedEnd);
     var elementSize = regions.Select(x => x.ElementSize).Distinct().Single();
     return new DataCenterRegion(start, (int)(end - start), (int)(paddedEnd - start), elementSize);
 }
开发者ID:anders0913,项目名称:TeraDataTools,代码行数:8,代码来源:DataCenterRegion.cs

示例3: PrintStrings

 public static void PrintStrings(ICollection<DisplayString> strings)
 {
     var stringIdWidth = strings.Max(s => s.StringID.Length);
     var format = string.Format("{{0,-{0}}}  {{1}}", stringIdWidth);
     foreach (var str in strings)
         Console.WriteLine(format, str.StringID, str.String);
 }
开发者ID:TheGuardians,项目名称:TagTool,代码行数:7,代码来源:LocalizedStringPrinter.cs

示例4: FindHighcard

        // http://stackoverflow.com/questions/1101841/linq-how-to-perform-max-on-a-property-of-all-objects-in-a-collection-and-ret
        public static int FindHighcard(ICollection<Card> cardsinHand)
        {
            var highCardVal = 2;
                highCardVal = cardsinHand.Max(x => x.Rank);

                return highCardVal;
        }
开发者ID:MattPuzey,项目名称:Katas,代码行数:8,代码来源:PokerHands.cs

示例5: Aggregate

 /// <summary>
 /// Aggregates all of the FlowExecutionStatuses of the
 /// FlowExecutions into one status. The aggregate status will be the
 /// status with the highest precedence.
 /// </summary>
 /// <param name="executions"></param>
 /// <returns></returns>
 public FlowExecutionStatus Aggregate(ICollection<FlowExecution> executions)
 {
     if (executions == null || executions.Count == 0)
     {
         return FlowExecutionStatus.Unkown;
     }
     return executions.Max().Status;
 }
开发者ID:pkubryk,项目名称:SummerBatch,代码行数:15,代码来源:MaxValueFlowExecutionAggregator.cs

示例6: GetSummary

 private static SummaryViewModel GetSummary(ICollection<TableProjection> tables)
 {
     return new SummaryViewModel
     {
         TablesCount = tables.Count,
         AverageColumnsPerTable = (int) Math.Round(tables.Average(x => x.ColumnsCount)),
         MaxColumnsPerTable = tables.Max(x => x.ColumnsCount)
     };
 }
开发者ID:titarenko,项目名称:OracleFiddler,代码行数:9,代码来源:SchemaExplorerController.cs

示例7: TimingStatSummary

 public TimingStatSummary(ICollection<TimingStat> stats, DateTime start, DateTime end) {
     Stats = stats;
     Count = Stats.Sum(s => s.Count);
     MinDuration = Stats.Min(s => s.MinDuration);
     MaxDuration = Stats.Max(s => s.MaxDuration);
     TotalDuration = Stats.Sum(s => s.TotalDuration);
     AverageDuration = Count > 0 ? (double)TotalDuration / Count : 0;
     StartTime = start;
     EndTime = end;
 }
开发者ID:geffzhang,项目名称:Foundatio,代码行数:10,代码来源:TimingStat.cs

示例8: GaugeStatSummary

 public GaugeStatSummary(ICollection<GaugeStat> stats, DateTime start, DateTime end) {
     Stats = stats;
     Count = Stats.Sum(s => s.Count);
     Total = Stats.Sum(s => s.Total);
     Last = Stats.Last().Last;
     Min = Stats.Min(s => s.Min);
     Max = Stats.Max(s => s.Max);
     StartTime = start;
     EndTime = end;
     Average = Count > 0 ? Total / Count : 0;
 }
开发者ID:geffzhang,项目名称:Foundatio,代码行数:11,代码来源:GaugeStat.cs

示例9: Calculate

 public void Calculate(ICollection<Double> realization )
 {
     Rows = new Collection<IntervalData>();
     this.variationRange = realization.Max() - realization.Min();
     if (this.variationRange < 0.99)
     {
         this.variationRange = 1;
     }
     this.intervalLength = this.variationRange/IntervalNumber;
     this.FindIntervalHits(realization);
 }
开发者ID:romannort,项目名称:Modeling.LabOne,代码行数:11,代码来源:HistogramData.cs

示例10: GetHoursByDay_LEFT_HOURS_AHEAD

        private ICollection<BurndownLeftHoursByDay> GetHoursByDay_LEFT_HOURS_AHEAD(ICollection<BurndownLeftHoursByDay> leftHours, Project project)
        {
            if (DateTime.Today > project.LastSprint.EndDate || DateTime.Today < project.FirstSprint.StartDate)
                return new BurndownLeftHoursByDay[0];

            if(leftHours.Count==0)
                return new BurndownLeftHoursByDay[0];

            DateTime lastDay = leftHours.Max(h => h.Date);
            BurndownLeftHoursByDay last = leftHours.Single(b => b.Date == lastDay);

            BurndownLeftHoursByDay[] hoursAhead = new BurndownLeftHoursByDay[2];
            hoursAhead[0] = new BurndownLeftHoursByDay() { Date = lastDay, TotalHours = last.TotalHours, LeftHoursMetric = LeftHoursMetrics.LEFT_HOURS_AHEAD };
            hoursAhead[1] = new BurndownLeftHoursByDay() { Date = project.LastSprint.EndDate, TotalHours = last.TotalHours, LeftHoursMetric = LeftHoursMetrics.LEFT_HOURS_AHEAD, IsLastSprint = true };

            return hoursAhead;
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:17,代码来源:BacklogService.Burndown.cs

示例11: EnsureAllDatesAreThere

        private void EnsureAllDatesAreThere(ICollection<StatisticChartItem> result, double valueForFilledDates)
        {
            var endDate = new DateTimeOffset(result.Max(f => f.Date));
            if (this.Parameter.EndDate >= DateTimeOffset.Now)
            {
                endDate = DateTimeOffset.Now;
            }

            for (var date = this.Parameter.StartDate; date <= endDate; date = date.AddDays(1))
            {
                var dateIsMissing = result.Any(f => f.Date.Date == date.Date) == false; //Ignore time-zone when checking if a date is missing
                if (dateIsMissing)
                {
                    result.Add(new StatisticChartItem
                    {
                        Date = date.Date,
                        Value = valueForFilledDates
                    });
                }
            }
        }
开发者ID:haefele,项目名称:CTime2,代码行数:21,代码来源:DetailedStatisticViewModel.cs

示例12: CalculateHistogramData

        private static IEnumerable<double> CalculateHistogramData(ICollection<Double> realization )
        {
            ICollection<Double> result = new List<double>();

            const Int32 intervalCount = 20;
            Double maxVlaue = realization.Max();
            Double minValue = realization.Min();
            Double intervalLength = (maxVlaue - minValue) / intervalCount;

            Double from = minValue;
            Double to = minValue + intervalLength;

            for (int i = 0; i < 20; ++i)
            {
                Int32 hits = realization.Count(r => r > from && r <= to );
                Double probability = (Double)hits / realization.Count;

                result.Add(probability);

                from += intervalLength;
                to += intervalLength;
            }

            return result;
        }
开发者ID:romannort,项目名称:Modeling.LabTwo,代码行数:25,代码来源:MainWindow.xaml.cs

示例13: DoStepResult

 private static void DoStepResult(StringBuilder writer, string stepName, ICollection<CaseStep> steps, int depth = 0)
 {
     string preChar = "".PadLeft(depth * 4);
     double minTime = steps.Min(t => t.Timer.MinTime);
     double aveTime = steps.Average(t => t.Timer.AveTime);
     double maxTime = steps.Max(t => t.Timer.MaxTime);
     int successNum = steps.Sum(t => t.Timer.SuccessNum);
     int failNum = steps.Sum(t => t.Timer.FailNum);
     if (failNum > 0)
     {
         string error = string.Join("", steps.Select(t => t.Timer.Error).ToList());
         TraceLog.WriteError("{0}", error);
     }
     writer.AppendFormat("{0}>>Step {1}: success:{2}, fail:{3}", preChar, stepName, successNum, failNum);
     writer.AppendLine();
     writer.AppendFormat("{0}    AVE:\t{1}ms", preChar, aveTime.ToString("F6"));
     writer.AppendLine();
     writer.AppendFormat("{0}    Min:\t{1}ms", preChar, minTime.ToString("F6"));
     writer.AppendLine();
     writer.AppendFormat("{0}    Max:\t{1}ms", preChar, maxTime.ToString("F6"));
     writer.AppendLine();
     var childs = steps.Where(t => t.ChildStep != null).Select(t => t.ChildStep).ToArray();
     if (childs.Length > 0)
     {
         DoStepResult(writer, childs[0].Action, childs, depth + 1);
     }
 }
开发者ID:lvshiling,项目名称:Scut,代码行数:27,代码来源:ThreadManager.cs

示例14: GetSummaryReport

        public static string GetSummaryReport(ICollection<SessionEx> sessions)
        {
            var res = new StringBuilder(DefaultBufferSize);

            res.AppendLine("Name\tValue");

            if (sessions.Count > 0)
            {
                var minDate = sessions.Min(session => session.LastUpdateTime);
                res.AppendLine("MinDate\t{0}", minDate.ToString("yyyy-MM-dd HH:mm:ss"));

                var maxDate = sessions.Max(session => session.LastUpdateTime);
                res.AppendLine("MaxDate\t{0}", maxDate.ToString("yyyy-MM-dd HH:mm:ss"));
            }

            // append leading space as a workaround for the PowerPivot quirk
            // http://social.msdn.microsoft.com/Forums/en-US/sqlkjpowerpivotforexcel/thread/456699ec-b5a2-4ae9-bc9f-b7ed2d637959
            res.AppendLine("SessionsCount\t {0}", sessions.Count);

            var latencyRecordsCount = sessions.Aggregate(0,
                (val, session) => val + session.Records.Where(Util.IsLatency).Count());
            res.AppendLine("LatencyRecordsCount\t {0}", latencyRecordsCount);

            var jitterRecordsCount = sessions.Aggregate(0,
                (val, session) => val + session.Records.Where(Util.IsJitter).Count());
            res.AppendLine("JitterRecordsCount\t {0}", jitterRecordsCount);

            return res.ToString();
        }
开发者ID:sopel,项目名称:AppMetrics,代码行数:29,代码来源:Report.cs

示例15: SetDConnectorMotifSpanScale

        protected void SetDConnectorMotifSpanScale (ICollection<Motif> oDConnectorMotifs)
        {
            Debug.Assert(oDConnectorMotifs != null);

            // The SpanScale property is the DConnectorMotif's span count scaled
            // between 0 and 1.0, based on the minimum and maximum span counts
            // among all DConnectorMotifs.

            Int32 iMinimumSpanCount = 0;
            Int32 iMaximumSpanCount = 0;

            if (oDConnectorMotifs.Count > 0)
            {
                iMinimumSpanCount = oDConnectorMotifs.Min(
                    oMotif => ((DConnectorMotif)oMotif).SpanVertices.Count);

                iMaximumSpanCount = oDConnectorMotifs.Max(
                    oMotif => ((DConnectorMotif)oMotif).SpanVertices.Count);
            }

            foreach (DConnectorMotif oDConnectorMotif in oDConnectorMotifs)
            {
                Single fSpanScale;

                if (iMinimumSpanCount == iMaximumSpanCount)
                {
                    // All the span counts are the same.  Arbitrarily set the
                    // SpanScale property to the center of the range.

                    fSpanScale = 0.5F;
                }
                else
                {
                    fSpanScale = MathUtil.TransformValueToRange(
                        oDConnectorMotif.SpanVertices.Count,
                        iMinimumSpanCount, iMaximumSpanCount,
                        0F, 1.0F
                        );
                }

                oDConnectorMotif.SpanScale = fSpanScale;
            }
        }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:43,代码来源:DConnectorMotifDetector.cs


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