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


C# IList.All方法代码示例

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


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

示例1: FileConfigurationStore

        public FileConfigurationStore(IList<string> filePaths)
        {
            if (filePaths == null ||
                filePaths.Count == 0 ||
                !filePaths.All(c => !String.IsNullOrWhiteSpace(c)))
                throw new ArgumentNullException("filePaths", "The parameter filePaths cannot be empty or contains empty string");

            this.fileIniDataParser = new FileIniDataParser();
            this.fileIniDataParser.Parser.Configuration.CommentString = "#";
            this.filePaths = filePaths;
        }
开发者ID:vihongphuc,项目名称:NLogging_Rollbar,代码行数:11,代码来源:FileConfigurationStore.cs

示例2: AddWatcher

        public PropertyChangeWatcher AddWatcher(IList<string> propertyNames, Action handler)
        {
            Contract.Requires(handler != null);
            Contract.Requires(propertyNames != null);
            Contract.Requires(propertyNames.Count > 0);
            Contract.Requires(propertyNames.AllUnique());
            Util.ThrowUnless(propertyNames.All(name => OwnerType.HasPublicInstanceProperty(name)), "The target object does not contain one or more of the properties provided");

            lock (_handlers)
            {
                foreach (var key in propertyNames)
                {
                    Util.ThrowUnless<ArgumentException>(!IsWatching(key), "Must not already be watching property '{0}'".DoFormat(key));
                }

                if (_handlers.Count == 0)
                {
                    _owner.PropertyChanged += _owner_PropertyChanged;
                }

                foreach (var propertyName in propertyNames)
                {
                    _handlers[propertyName] = handler;
                }
                return this;
            }
        }
开发者ID:heartszhang,项目名称:WeiZhi3,代码行数:27,代码来源:PropertyChangeWatcher.cs

示例3: Create

 internal static CompareResult Create(IList<StringDifferencePair> stringDifferenceEnumerable)
 {
     return Set(
         stringDifferenceEnumerable.All(sd => sd.Similar),
         stringDifferenceEnumerable
     );
 }
开发者ID:LosManos,项目名称:BoAndTheBovine,代码行数:7,代码来源:CompareResult.cs

示例4: CleanOldFiles

        private static void CleanOldFiles(IList<string> files, string referencesFile, string sourceFolder, bool needsExtending)
        {
            if (needsExtending)
            {
                files = files.Select(x => string.Format("{0}{1}", x, Program.NEEDS_EXTENDING_EXTENSION)).ToList();
            }

            var lines = File.ReadAllLines(referencesFile).ToList();
            var stringBuilder = new StringBuilder();

            var linesToRemove = lines
                .Where(x => IsAReferenceInFolderButNotSubfolder(x, sourceFolder) && files.All(y => y != GetFileName(x)))
                .ToList();

            foreach (var line in linesToRemove)
            {
                lines.Remove(line);
            }

            var linesToAdd = files
                .Where(x => lines.All(y => GetFileName(y) != x))
                .Select(x => string.Format("/// <reference path=\"{0}/{1}.ts\" />", sourceFolder.Replace('\\', '/'), x))
                .ToList();

            lines.AddRange(linesToAdd);

            if (linesToRemove.Any() || linesToAdd.Any()) {
                File.WriteAllLines(referencesFile, lines);
            }
        }
开发者ID:JonathanLydall,项目名称:Java-Transpiler-In-C-Sharp,代码行数:30,代码来源:TypeScriptReferences.cs

示例5: Convert

        public static IEnumerable<EntitySet> Convert(
            IList<EntitySet> sourceEntitySets,
            Version targetEntityFrameworkVersion,
            string providerInvariantName,
            string providerManifestToken,
            IDbDependencyResolver dependencyResolver)
        {
            Debug.Assert(sourceEntitySets != null, "sourceEntitySets != null");
            Debug.Assert(sourceEntitySets.All(e => e.DefiningQuery == null), "unexpected defining query");
            Debug.Assert(!string.IsNullOrWhiteSpace(providerInvariantName), "invalid providerInvariantName");
            Debug.Assert(!string.IsNullOrWhiteSpace(providerManifestToken), "invalid providerManifestToken");
            Debug.Assert(dependencyResolver != null, "dependencyResolver != null");

            if (!sourceEntitySets.Any())
            {
                // it's empty anyways
                return sourceEntitySets;
            }

            var providerServices = dependencyResolver.GetService<DbProviderServices>(providerInvariantName);
            Debug.Assert(providerServices != null, "providerServices != null");

            var transientWorkspace =
                CreateTransientMetadataWorkspace(
                    sourceEntitySets,
                    targetEntityFrameworkVersion,
                    providerInvariantName,
                    providerManifestToken,
                    providerServices.GetProviderManifest(providerManifestToken));

            return sourceEntitySets.Select(
                e => CloneWithDefiningQuery(
                    e,
                    CreateDefiningQuery(e, transientWorkspace, providerServices)));
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:35,代码来源:EntitySetDefiningQueryConverter.cs

示例6: Compare

 private static IEnumerable<Sim> Compare(Quest fromQuest, string[] fromRoute, IList<Quest> questDB)
 {
     DolRoute EL = new DolRoute();
     var simList = new List<Sim>();
     questDB.All(quest =>
     {
         if (quest.ID == fromQuest.ID)
             return true;
         if (quest.RouteForSim.Count != 0)
         {
             var min = quest.RouteForSim.Min(route =>
             {
                 if (route.Count < 2)
                     return 2001;
                 var value = EL.Compute(fromRoute, route.ToArray());
                 return value;
             });
             if (min < 2000)
             {
                 simList.Add(new Sim()
                 {
                     CompareID = quest.ID,
                     QuestID = fromQuest.ID,
                     Value = min,
                     StartCity = EL.GetCityID(fromRoute[0])
                 });
             }
         }
         return true;
     });
     return simList.OrderBy(sim => sim.Value).Take(300);
 }
开发者ID:hefangshi,项目名称:dolmap-data,代码行数:32,代码来源:Program.cs

示例7: SlowButSureAssertCollected

 static void SlowButSureAssertCollected(IList<WeakReference> nextIterationHolder) {
     GC.GetTotalMemory(true);
     if(nextIterationHolder.All(wr => !wr.IsAlive))
         return;
     GC.Collect();
     if(nextIterationHolder.All(wr => !wr.IsAlive))
         return;
     GC.GetTotalMemory(true);
     var notCollected = nextIterationHolder.Select(wr => wr.Target).Where(t => t != null).ToArray();
     if(notCollected.Length == 0)
         return;
     var objectsReport = string.Join("\n", notCollected.GroupBy(o => o.GetType()).OrderBy(gr => gr.Key.FullName)
         .Select(gr => string.Format("\t{0} object(s) of type {1}:\n{2}", gr.Count(), gr.Key.FullName
             , string.Join("\n", gr.Select(o => o.ToString()).OrderBy(s => s).Select(s => string.Format("\t\t{0}", s)))
             )));
     throw new Exception(string.Format("{0} garbage object(s) not collected:\n{1}", notCollected.Length, objectsReport));
 }
开发者ID:LINDAIS,项目名称:DevExpress.Mvvm.Free,代码行数:17,代码来源:GCTestHelpers.cs

示例8: ContainsRequiredHeaders

        private bool ContainsRequiredHeaders(IList<string> headers)
        {
            var requiredHeaders = new List<string>();
            requiredHeaders.Add("header1");
            requiredHeaders.Add("header2");

            return headers.All(requiredHeaders.Contains) && headers.Count == requiredHeaders.Count;
        }
开发者ID:tommy-ly,项目名称:CsvHelperSpike,代码行数:8,代码来源:WhateverServiceTests.cs

示例9: ValidateBarcodes

 public bool ValidateBarcodes(IList<string> barcodes)
 {
     if (barcodes == null)
     {
         return false;
     }
     return barcodes.All(b => m_productRepository.GetByBarcodes(b).IsNotEmpty());
 }
开发者ID:yanpei,项目名称:PosMachine,代码行数:8,代码来源:PromotionService.cs

示例10: TopScore

        private static Language? TopScore(IList<AnalysisResult> source)
        {
            if (source.All(x => x.Score == 0))
            {
                return null;
            }

            return source?.Aggregate((l, r) => l.Score > r.Score ? l : r).Language;
        }
开发者ID:nbarbettini,项目名称:polyglot-dotnet,代码行数:9,代码来源:AssemblyAnalyzer.cs

示例11: LoadNextTheme

        private static void LoadNextTheme(string currentThemeName, IList<Theme> allThemes)
        {
            if (allThemes.All(x => !x.Active)) return; // No active theme, so exit immediatly.

            var idx = GetCurrentThemeIndex(allThemes, currentThemeName);
            var themeToLoad = GetNextActiveTheme(allThemes, idx);

            ThemeLoader.LoadTheme(themeToLoad);
        }
开发者ID:modulexcite,项目名称:ThemeSwitcher,代码行数:9,代码来源:ThemeCycler.cs

示例12: HeightOf

        protected static int HeightOf(IList<RectangularStep> upstream)
        {
            if (upstream == null || upstream.Count == 0) throw new ArgumentException();

            int height = upstream[0].Height;

            if (!upstream.All(step => step.Height == height)) throw new ArgumentException();

            return height;
        }
开发者ID:patrickmeiring,项目名称:LeNet,代码行数:10,代码来源:RectangularStep.cs

示例13: WidthOf

        protected static int WidthOf(IList<RectangularStep> upstream)
        {
            if (upstream == null || upstream.Count == 0) throw new ArgumentException();

            int width = upstream[0].Width;

            if (!upstream.All(step => step.Width == width)) throw new ArgumentException();

            return width;
        }
开发者ID:patrickmeiring,项目名称:LeNet,代码行数:10,代码来源:RectangularStep.cs

示例14: GetDiscountAmount

        public override double GetDiscountAmount(IList<BasketItem> items)
        {
            //If there is no bread, do not fuss
            if (items.All(i => i.ItemType != BasketItemType.Milk))
            {
                return 0.0;
            }

            return items.First(i => i.ItemType == BasketItemType.Milk).Price;
        }
开发者ID:bilsay,项目名称:BasketCase,代码行数:10,代码来源:FourthMilkFreeOffer.cs

示例15: BuildMessage

        public string BuildMessage(IList<TeamCityModel> buildStatuses, out bool notify)
        {
            var success = buildStatuses.Count == _expectedBuildCount &&
                          buildStatuses.All(buildStatus => IsSuccesfullBuild(buildStatus.build));

            notify = !success;

            return success ? BuildSuccessMessage(buildStatuses.First().build) :
                             BuildFailureMessage(buildStatuses.Select(m => m.build).ToList());
        }
开发者ID:martinskuta,项目名称:Nubot,代码行数:10,代码来源:TeamCityMessageBuilder.cs


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