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


C# IReadOnlyCollection.Count方法代码示例

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


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

示例1: ComputeStatsForAllTime

        public void ComputeStatsForAllTime(IReadOnlyCollection<Report> allReports, StatsViewModel vm)
        {
            var allCreated =    allReports.Count(report => report.Status == ReportStatus.Created);
            var allCompleted  = allReports.Count(report => report.Status == ReportStatus.Completed);
            var allProcessing = allReports.Count(report => report.Status == ReportStatus.Processing);
            var allFailed     = allReports.Count(report => report.Status == ReportStatus.Failure);
            var allSummary    = allReports.Count;

            vm.AllTime = new StatsViewModel.AllTimeStats
            {
                Numbers      = new StatsViewModel.Numbers
                {
                    ReportsCount      = allSummary,
                    ReportsCreated    = allCreated,
                    ReportsCompleted  = allCompleted,
                    ReportsProcessing = allProcessing,
                    ReportsFailed     = allFailed
                },
                Percentages  = new StatsViewModel.Percentages
                {
                    AverageReportsCompleted  = (double)allCompleted  / (allSummary) * 100.0,
                    AverageReportsProcessing = (double)allProcessing / (allSummary) * 100.0,
                    AverageReportsFailure    = (double)allFailed     / (allSummary) * 100.0
                }
            };
        }
开发者ID:gboduljak,项目名称:Emergy,代码行数:26,代码来源:StatsService.cs

示例2: Analyze

        public IEnumerable<Fact> Analyze(IReadOnlyCollection<DiceRoll> statistics)
        {
            ICollection<Fact> facts = new Collection<Fact>();
            var statisticsCount = statistics.Count(); //check for real diceroll

            var successfulFact = new Fact
            {
                Description = "Count",
                Divident = statisticsCount,
                Divider = statisticsCount
            };
            facts.Add(successfulFact);

            var sameFact = new Fact
            {
                Description = "Same",
                Divident = statistics.Count(o => o.IsSameValue),
                Divider = statisticsCount
            };
            facts.Add(sameFact);

            var minSum = statistics.Min(o => o.Sum);
            var maxSum = statistics.Max(o => o.Sum);

            for (var i = minSum; i <= maxSum; i++)
            {
                var sumFact = new Fact
                {
                    Description = "Sum " + i,
                    Divident = statistics.Count(o => o.Sum == i),
                    Divider = statisticsCount
                };
                facts.Add(sumFact);
            }

            //add single value fact generation

            return facts;
        }
开发者ID:KefirNot,项目名称:VirtualMonopoly,代码行数:39,代码来源:DiceRollAnalyzer.cs

示例3: UpdateMultiple

        async Task<string[]> UpdateMultiple(IReadOnlyCollection<FileObjectMapping> objects,
            IReadOnlyCollection<Package> packages,
            IEnumerable<Uri> remotes) {
            if (!objects.Any()) {
                Repository.Log("No remote objects to resolve");
                return new string[0];
            }
            Repository.Log("Resolving {0} remote objects for {1} packages from {2} remotes, please be patient..",
                objects.Count(), packages.Count(), remotes.Count());

            var relObjects = objects.OrderByDescending(x => Tools.FileUtil.SizePrediction(x.FilePath))
                .Select(x => new FileFetchInfo(Repo.GetObjectSubPath(x), x.FilePath))
                .ToArray();

            StatusRepo.Reset(RepoStatus.Downloading, objects.Count());
            StatusRepo.ProcessSize(GetExistingObjects(objects, packages), Repo.ObjectsPath, GetPackedSize(packages));
            await Package.DownloadObjects(remotes, StatusRepo, relObjects, Repo.ObjectsPath).ConfigureAwait(false);
            Repo.ReAddObject(objects.Select(x => x.Checksum).ToArray());

            return relObjects.Select(x => x.FilePath).ToArray();
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:21,代码来源:PackageManager.cs

示例4: Checkout

 // TODO: Async
 public Package[] Checkout(IReadOnlyCollection<string> packageNames, bool? useFullNameOverride = null) {
     StatusRepo.Reset(RepoStatus.CheckOut, packageNames.Count());
     return packageNames.Select(package => Checkout(package, useFullNameOverride)).ToArray();
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:5,代码来源:PackageManager.cs

示例5: CreateBatch

        private static void CreateBatch(IReadOnlyCollection<LogStatItem> records)
        {
            if (records == null)
            {
                ChangeThreadCount(-1);
                return;
            }
            ALogger.LogInfo("CreateBatch: start create batch {0}", records.Count);

            var batchCount = 0;
            var totaltestcases = records.Count();

            foreach (var item in records)
            {
                try
                {
                    if ((batchCount % _flushqueueLimit) == 0)
                    {
                        ALogger.LogDebug("CreateBatch: processing item: {0} / {1}", batchCount, totaltestcases);
                    }                    

                        while (FlushQueueReady() || !_mre.WaitOne(_checkFileTimeoutMs))
                        {
                            if (!FlushQueueReady())
                            {
                                ALogger.LogTrace("CreateBatch: Queue is not ready wait for the next {0} ms", _checkFileTimeoutMs);
                                continue;
                            }

                            _flushQueue.EnQueue(item);
                            batchCount++;
                            break;
                        }
                }
                catch (Exception ex)
                {
                    ALogger.LogError("CreateBatch: error processing item: {0}", ex.Message);
                }
            }

            ALogger.LogInfo("CreateBatch: Done create batch {0}/{1}", batchCount, totaltestcases);
            ChangeThreadCount(-1);
        }
开发者ID:montakan29,项目名称:TestGit,代码行数:43,代码来源:UpdateOpsConsoleDb.cs

示例6: Checkout

 public async Task<List<Package>> Checkout(IReadOnlyCollection<string> packageNames,
     bool? useFullNameOverride = null) {
     StatusRepo.Reset(RepoStatus.CheckOut, packageNames.Count());
     var packages = new List<Package>();
     foreach (var p in packageNames)
         packages.Add(await CheckoutAsync(p, useFullNameOverride).ConfigureAwait(false));
     return packages;
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:8,代码来源:PackageManager.cs

示例7: ImportReadOnlyCollectionService

		public ImportReadOnlyCollectionService(IReadOnlyCollection<ISimpleObject> simpleObjects)
		{
			Assert.NotNull(simpleObjects);
			Assert.Equal(5, simpleObjects.Count());
		}
开发者ID:jrjohn,项目名称:Grace,代码行数:5,代码来源:ImportReadOnlyCollectionService.cs


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