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


C# IList.Except方法代码示例

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


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

示例1: AddFiles

        public void AddFiles(DroneConfig config, IList<string> sourceFiles, IList<string> referenceFiles)
        {
            if(config == null)
                throw new ArgumentNullException("config");

            if(sourceFiles == null)
                throw new ArgumentNullException("sourceFiles");

            if(referenceFiles == null)
                throw new ArgumentNullException("referenceFiles");

            var sourcesToAdd = sourceFiles.Except(config.SourceFiles).ToList();

            var referencesToAdd = referenceFiles.Except(config.ReferenceFiles).ToList();

            if (sourcesToAdd.Count == 0 && referencesToAdd.Count == 0)
            {
                this.log.Warn("no files added. files already exists in config");
                return;
            }

            var fileNotFound = this.EnsureFilesExists(config.DirPath, sourcesToAdd.Concat(referencesToAdd));

            if (fileNotFound)
                return;

            config.SourceFiles.AddRange(sourcesToAdd);
            config.ReferenceFiles.AddRange(referencesToAdd);

            foreach (var file in sourcesToAdd.Concat(referencesToAdd))
                this.log.Info("added '{0}'", file);
        }
开发者ID:juankakode,项目名称:Drone,代码行数:32,代码来源:DroneService.cs

示例2: Send

        /// Assuming that excludeGroup is small
        public void Send(Packet packet, IList<NetNode> sendToList, IList<NetNode> excludeGroup, int channel = 0)
        {
            var msg = packet.SendMessage(this);

            var group = sendToList.Except(excludeGroup).Cast<NetConnection>().ToList();

            if (group.Count == 0) return;
            Peer.SendMessage(msg, group, (Lidgren.Network.NetDeliveryMethod)packet.Method, channel);
        }
开发者ID:jhlllnd,项目名称:Asgard,代码行数:10,代码来源:Connection.cs

示例3: Analyze

        public UserHistoryEntry Analyze(DateTime date, IList<long> before, IList<long> after)
        {
            var gainedIds = after.Except(before);
            var lostIds = before.Except(after);

            var allProfiles = parser.WhoAre(gainedIds.Concat(lostIds)).ToLookup(x => x.Id);

            var gained = Separate(gainedIds, allProfiles);
            var lost = Separate(lostIds, allProfiles);

            return new UserHistoryEntry(date, gained, lost, after.Count);
        }
开发者ID:juanplopes,项目名称:twitter-tracker,代码行数:12,代码来源:DifferencesAnalyzer.cs

示例4: UpdateProjects

 public void UpdateProjects(IList<string> newProjects)
 {
     var oldProjects = Projects.Select(x => x.ProjectFilePath).ToList();
     foreach (var i in newProjects.Except(oldProjects))
     {
         Projects.Add(new UploadProjectInfo(i));
     }
     foreach (var i in oldProjects.Except(newProjects))
     {
         Projects.RemoveAll(x => x.ProjectFilePath == i);
     }
 }
开发者ID:kashmervil,项目名称:trik-upload,代码行数:12,代码来源:SolutionManager.cs

示例5: ChooseSets

        public static List<int[]> ChooseSets(IList<int[]> sets, IList<int> universe)
        {
            var selectedSets = new List<int[]>();

            while (universe.Count > 0)
            {
                var currentSet = sets.OrderByDescending(s => s.Count(universe.Contains)).First();

                selectedSets.Add(currentSet);
                sets.Remove(currentSet);
                universe = universe.Except(currentSet).ToList();
            }

            return selectedSets;
        }
开发者ID:iliankostov,项目名称:Algorithms,代码行数:15,代码来源:SetCover.cs

示例6: SaveManga

        public async Task SaveManga(IList<JsonManga> mangas)
        {
            if (mangas == null)
                throw new ArgumentNullException("mangas");

            _logger.Trace("Saving " + mangas.Count() + " mangas to database...");

            using (MangaEdenContext context = new MangaEdenContext())
            {
                List<JsonManga> existing = await context.Mangas.ToListAsync();
                context.Mangas.AddRange(mangas.Except(existing, new JsonMangaComparer()));
                await context.SaveChangesAsync();

                _logger.Trace("Saved.");
            }
        }
开发者ID:BinaryTENSHi,项目名称:MangaEden,代码行数:16,代码来源:MangaManager.cs

示例7: ProcessWatchers

        public static IList<string> ProcessWatchers(this IBot bot, string repositoryName, IList<string> existingWatchers, IEnumerable<dynamic> watchers)
        {
            var currentWatchers = watchers.Select(c => c.login.ToString()).Cast<string>().ToList();
            var newWatchers = currentWatchers.Except(existingWatchers).ToList();
            foreach (var w in newWatchers)
            {
                bot.SayToAllRooms(string.Format("{0} is now watching {1}", w, repositoryName));
            }

            var noLongerWatching = existingWatchers.Except(currentWatchers).ToList();
            foreach (var w in noLongerWatching)
            {
                bot.SayToAllRooms(string.Format("{0} is no longer watching {1}", w, repositoryName));
            }

            return existingWatchers.Concat(newWatchers).Except(noLongerWatching).ToList();
        }
开发者ID:NickJosevski,项目名称:jibbr,代码行数:17,代码来源:BotWatcherExtensions.cs

示例8: UpdateReferences

        /// <summary>
        /// Update the project file with the given references. Only change the file if 
        /// there would be an actual change tot he file required
        /// </summary>
        /// <param name="references"></param>
        /// <returns>true if the project file was updated</returns>
        internal bool UpdateReferences(IList<Reference> references)
        {
            var xmlDoc = ReadXML();
            var existing = ReadReferences(xmlDoc).Where((r)=>r.HintPath != null).ToList();

            var update = existing.Count != references.Count;
            if (!update) {
                update = existing.Except(references).ToList().Count > 0;
            }
            if (!update) {
                update = references.Except(existing).ToList().Count > 0;
            }
            if (update) {
                WriteReferences(xmlDoc,references);
                return true;
            }
            return false;
        }
开发者ID:NRequire,项目名称:nrequire,代码行数:24,代码来源:VSProject.cs

示例9: SourceCreatorTreeNode

        public SourceCreatorTreeNode(ISourceFactory factory, Type baseType, IList<Type> creatorTypes)
        {
            m_type = baseType;

            if (!m_type.IsAbstract)
            {
                m_instance = Activator.CreateInstance(m_type, factory) as ISourceCreator;
                m_instance.Init();
            }

            var childCreatorTypes = creatorTypes.Where(t => t.BaseType == m_type).ToList();

            if (childCreatorTypes.Count > 0)
            {
                // remove children from search
                creatorTypes = creatorTypes.Except(childCreatorTypes).ToList();

                m_childCreatorNodes = childCreatorTypes.Select(t => new SourceCreatorTreeNode(factory, t, creatorTypes)).ToList();
            }
        }
开发者ID:jdauie,项目名称:squid,代码行数:20,代码来源:SourceCreatorTreeNode.cs

示例10: UniquifyParameterNames

        private static void UniquifyParameterNames(IList<FunctionParameter> parameters)
        {
            DebugCheck.NotNull(parameters);

            foreach (var parameter in parameters)
            {
                parameter.Name = parameters.Except(new[] { parameter }).UniquifyName(parameter.Name);
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:9,代码来源:ModificationFunctionMappingGenerator.cs

示例11: SetPointerOver

        private IInputElement SetPointerOver(IPointerDevice device, IInputRoot root, IList<IInputElement> elements)
        {
            foreach (var control in _pointerOvers.Except(elements).ToList())
            {
                PointerEventArgs e = new PointerEventArgs
                {
                    RoutedEvent = InputElement.PointerLeaveEvent,
                    Device = device,
                    Source = control,
                };

                _pointerOvers.Remove(control);
                control.RaiseEvent(e);
            }

            foreach (var control in elements.Except(_pointerOvers))
            {
                PointerEventArgs e = new PointerEventArgs
                {
                    RoutedEvent = InputElement.PointerEnterEvent,
                    Device = device,
                    Source = control,
                };

                _pointerOvers.Add(control);
                control.RaiseEvent(e);
            }

            root.PointerOverElement = elements.FirstOrDefault() ?? root;
            return root.PointerOverElement;
        }
开发者ID:rdterner,项目名称:Perspex,代码行数:31,代码来源:MouseDevice.cs

示例12: GetDifference

 private static IList<string> GetDifference(IList<string> existingHandles, IList<string> currentHandles)
 {
     // We are using LINQ to get the difference between the two lists.
     // The non-LINQ version looks like the following:
     // IList<string> differentHandles = new List<string>();
     // foreach (string handle in currentHandles)
     // {
     //    if (!existingHandles.Contains(handle))
     //    {
     //        currentHandles.Add(handle);
     //    }
     // }
     // return differentHandles;
     return currentHandles.Except(existingHandles).ToList();
 }
开发者ID:draculavlad,项目名称:selenium,代码行数:15,代码来源:PopupWindowFinder.cs

示例13: CompareListsNew

        private static void CompareListsNew(IList<Article> list1, List<Article> list2, ListBox lb1, ListBox lb2, ListBox lb3)
        {
            lb1.BeginUpdate();
            lb2.BeginUpdate();
            lb3.BeginUpdate();

            lb1.Items.AddRange(list1.Except(list2).ToArray());
            lb2.Items.AddRange(list2.Except(list1).ToArray());
            lb3.Items.AddRange(list1.Intersect(list2).ToArray());

            lb1.EndUpdate();
            lb2.EndUpdate();
            lb3.EndUpdate();
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:14,代码来源:ListComparer.cs

示例14: AssertTypeRule

// ReSharper disable UnusedParameter.Local
        private void AssertTypeRule(
            Func<Type, IArgumentNullExceptionFixture> addMethod,
            IList<RegexRule> existingRules,
            IList<RegexRule> regexRules,
            bool expectedInclude)
        {
            IArgumentNullExceptionFixture actual = addMethod(GetType());

            Assert.Same(addMethod.Target, actual);
            Assert.Equal(existingRules.Count + 1, regexRules.Count);
            Assert.False(existingRules.Except(regexRules).Any());
            RegexRule addedRule = regexRules.Except(existingRules).Single();
            Assert.Equal(expectedInclude, addedRule.Include);
            Assert.NotNull(addedRule.Type);
            Assert.Null(addedRule.Method);
            Assert.Null(addedRule.Parameter);
            Assert.True(addedRule.MatchType(GetType()));
        }
开发者ID:AutoTestNET,项目名称:AutoTest.ArgumentNullException,代码行数:19,代码来源:ArgumentNullExceptionFixtureExtensionsShould.cs

示例15: AllowTransitions

 /// <summary>
 /// allows only what is found in the return value of WhiteList
 /// </summary>
 public IEnumerable<ITransition> AllowTransitions(IList<ITransition> transitions)
 {
     return transitions.Except(base.TransitionsInCommonWithList(transitions))
         .Where(x => object.Equals(x.WorkflowId, _workflowId));
 }
开发者ID:rajeshgupthar,项目名称:objectflow,代码行数:8,代码来源:RelaxedTransitionGateway.cs


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