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


C# IEnumerable.Each方法代码示例

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


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

示例1: SolutionGraph

    public SolutionGraph(IEnumerable<Solution> solutions)
    {
        _allNugets = new Lazy<IEnumerable<NugetSpec>>(() => _solutions.SelectMany(x => x.PublishedNugets).ToList());

            solutions.Each(s => _solutions[s.Name] = s);
            solutions.Each(s => s.DetermineDependencies(FindNugetSpec));

            _orderedSolutions = new Lazy<IList<Solution>>(() =>
            {
                var graph = new DependencyGraph<Solution>(s => s.Name, s => s.SolutionDependencies().Select(x => x.Name));
                solutions.Each(graph.RegisterItem);
                return graph.Ordered().ToList();
            });
    }
开发者ID:KevM,项目名称:ripple,代码行数:14,代码来源:SolutionGraph.cs

示例2: FubuMvcContext

        public FubuMvcContext(IFubuMvcSystem system)
        {
            _system = system;

            _contextualProviders = system.ContextualProviders ?? new IContextualInfoProvider[0];
            _contextualProviders.Each(x => x.Reset());
        }
开发者ID:DarthFubuMVC,项目名称:Serenity,代码行数:7,代码来源:FubuMvcContext.cs

示例3: ThreadSafeLocaleCache

        public ThreadSafeLocaleCache(CultureInfo culture, IEnumerable<LocalString> strings)
        {
            _data = new Dictionary<LocalizationKey, string>();
            strings.Each(s => _data.Add(new LocalizationKey(s.value), s.display));

            _culture = culture;
        }
开发者ID:henninga,项目名称:fubulocalization,代码行数:7,代码来源:ThreadSafeLocaleCache.cs

示例4: GenerateType

        public static Type GenerateType(Type baseType, IEnumerable<Type> interfaceTypes)
        {
            var newType = dynamicModule.DefineType(
                Prefix + "." + baseType.GetName(),
                TypeAttributes.AutoLayout | TypeAttributes.Public | TypeAttributes.Class,
                baseType);

            interfaceTypes.Each(interfaceType =>
            {
                newType.AddInterfaceImplementation(interfaceType);
                interfaceType.GetMethods().Each(method =>
                {
                    ImplementInterfaceMethod(newType, method);
                });
            });

            baseType.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Each(constructor =>
            {
                switch (constructor.Attributes & MethodAttributes.MemberAccessMask)
                {
                    case MethodAttributes.Family:
                    case MethodAttributes.Public:
                    case MethodAttributes.FamORAssem:
                        ImplementConstructor(newType, constructor);
                        break;
                }
            });

            return newType.CreateType();
        }
开发者ID:vialpando09,项目名称:RallyPortal2,代码行数:30,代码来源:DynamicTypeBuilder.cs

示例5: CreateInclusionPolicy

 public static FileInclusionPolicy CreateInclusionPolicy(IEnumerable<string> excludes = null, IEnumerable<string> includes = null)
 {
     var policy = new FileInclusionPolicy();
     if (excludes != null) excludes.Each(policy.AddExclude);
     if(includes != null) includes.Each(policy.AddInclude);
     return policy;
 }
开发者ID:tpeplow,项目名称:Projector,代码行数:7,代码来源:TestEntityFactory.cs

示例6: AggregateResult

        public AggregateResult(IEnumerable<GameResult> results)
        {
            _playerToScoreMap = new Dictionary<BotPlayer, int>();
              results.SelectMany(x => x.Players).Each(x => _playerToScoreMap[x] = 0);

              results.Each(result =>
              {
            if (result.IsTie)
            {
              result.Players.Each(player =>
              {
            _playerToScoreMap[player]++;
              });
            }
            else
            {
              _playerToScoreMap[result.Winner] += 3;
            }
              });

              var winners = _playerToScoreMap.GroupBy(x => x.Value).OrderByDescending(x => x.Key).First();

              if (winners.Count() == _playerToScoreMap.Count)
              {
            IsTie = true;
              }
              else
              {
            Winner = winners.First().Key;
              }
        }
开发者ID:aaronjensen,项目名称:compete,代码行数:31,代码来源:AggregateResult.cs

示例7: Activate

        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            var provider = new FileSystemVirtualPathProvider();
            HostingEnvironment.RegisterVirtualPathProvider(provider);

            packages.Each(x => x.ForFolder(FubuMvcPackages.WebContentFolder, provider.RegisterContentDirectory));
        }
开发者ID:sbartlett,项目名称:fubumvc,代码行数:7,代码来源:VirtualPathProviderPackageActivator.cs

示例8: Activate

        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            ReadScriptConfig(FubuMvcPackageFacility.GetApplicationPath(), log);
            packages.Each(p => p.ForFolder(BottleFiles.WebContentFolder, folder => ReadScriptConfig(folder, log)));

            _assets.CompileDependencies(log);
        }
开发者ID:hartez,项目名称:fubumvc,代码行数:7,代码来源:AssetGraphConfigurationActivator.cs

示例9: Report

        public void Report(IEnumerable<SuiteRunResult> executed)
        {
            var totalPasses = executed.Sum(x => x.Passes);
            var totalFailures = executed.Sum(x => x.Failures);
            var total = totalPasses + totalFailures;

            _output.WriteLine("Loaded: {0}".FormatWith(executed.Select(s => s.Name).Join(", ")));
            _output.WriteLine("  {0} {1} loaded.".FormatWith(
                total,
                "test".Pluralize(total)));
            _output.WriteLine("  {0}/{1} {2} passed ({3} {4}).".FormatWith(
                totalPasses,
                total,
                "test".Pluralize(total),
                totalFailures,
                "failure".Pluralize(totalFailures)));

            if (totalFailures > 0)
                _output.WriteLine("Failures: ");
            executed.Each(suiteResult => suiteResult
                .Results
                .Where(containerResult => containerResult.Results.Any(r => !r.Pass))
                .Each(f =>
                {
                    _output.WriteLine("  {0}.{1} contained {2} failures.".FormatWith(suiteResult.Name, f.Name, f.Failures));
                    f.Results.Where(r => !r.Pass).Each(r => _output.WriteLine("    {0} failed. [{1}]".FormatWith(r.Name, r.Message)));
                }));

            _output.Flush();
        }
开发者ID:jonfuller,项目名称:class,代码行数:30,代码来源:TextReporter.cs

示例10: EachWithFunc

		public void EachWithFunc( IEnumerable<object> sut )
		{
			var copy = sut.ToList();
			Func<object, bool> action = copy.Remove;
			var results = sut.Each( action );
			Assert.All( results,  b => b.IsFalse( () => { throw new InvalidOperationException( "was not true." ); } ) );
		}
开发者ID:DevelopersWin,项目名称:VoteReporter,代码行数:7,代码来源:EnumerableExtensionsTests.cs

示例11: Each

		public void Each( IEnumerable<object> sut )
		{
			var count = 0;
			Action<object> action = o => count++;
			sut.Each( action );
			Assert.Equal( sut.Count(), count );
		}
开发者ID:DevelopersWin,项目名称:VoteReporter,代码行数:7,代码来源:EnumerableExtensionsTests.cs

示例12: Bootstrap

        public IEnumerable<IActivator> Bootstrap(IPackageLog log)
        {
            _services = _inner.Bootstrap(log).Select(x => new BottleService(x, log));
            _services.Each(x => x.Start());

            return new IActivator[0];
        }
开发者ID:DarthFubuMVC,项目名称:bottles,代码行数:7,代码来源:WrappedBootstrapper.cs

示例13: Draw

 public void Draw(IEnumerable<Card> cards)
 {
     cards.Each(card =>
                    {
                        RemoveCardFromDeck(card);
                        Player.AddCardToHand(card);
                    });
 }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:8,代码来源:HeroDeckSource.cs

示例14: Discard

 public void Discard(IEnumerable<Card> cards)
 {
     cards.Each(card =>
                    {
                        RemoveCardFromDeck(card);
                        Player.AddToDiscard(card);
                    });
 }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:8,代码来源:HeroDeckSource.cs

示例15: applyBufferingToChildSectionLines

 protected override void applyBufferingToChildSectionLines(IEnumerable<Line> sectionLines, int index)
 {
     if (isSubsequentLine(index))
     {
         var buffer = (Convert.ToChar(9475).ToString() + " ").PadLeft(_tabWidth);
         sectionLines.Each(x => x.Prepend(buffer));
     }
 }
开发者ID:slahn,项目名称:structuremap,代码行数:8,代码来源:Outline.cs


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