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


C# IList.Each方法代码示例

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


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

示例1: ProcessRolesFilter

 private  IList<int> ProcessRolesFilter(IList<string> currentUserRoles)
 {
  
     var rolesToFilter = new List<int>();
     currentUserRoles.Each(r =>
     {
         switch (r)
         {
             case RolesConstants.SuperAdmin:
                 rolesToFilter.AddRange(new int[]
             {
                 RolesConstants.RoleIdsDictionary[RolesConstants.SetupSuperAdmin],
                 RolesConstants.RoleIdsDictionary[RolesConstants.ActivitySuperAdmin],
             });
                 break;
             case RolesConstants.SetupSuperAdmin:
                 rolesToFilter.AddRange(new int[]
             {
                 RolesConstants.RoleIdsDictionary[RolesConstants.StateAdmin]
             });
                 break;
             case RolesConstants.StateAdmin:
                 rolesToFilter.AddRange(new int[]
             {
                 RolesConstants.RoleIdsDictionary[RolesConstants.SetupStateAdmin],
                 RolesConstants.RoleIdsDictionary[RolesConstants.ActivityStateAdmin],
             });
                 break;
         }
     });
     return rolesToFilter;
 }
开发者ID:surifoll,项目名称:git-test,代码行数:32,代码来源:UserProfileService.cs

示例2: Execute

        public int Execute()
        {
            try
            {
                prepareResultsFolder();

                _projects = _projectFiles.Select(file =>
                {
                    Console.WriteLine("Loading Project at " + file);
                    return Project.LoadFromFile(file) as IProject;
                }).ToList();

                var names = _projects.Select(x => x.Name).ToArray().Join(", ");
                _summary.Start("Project(s):  " + names, DateTime.Now);

                _projects.Each(p =>
                {
                    Console.WriteLine("Running Project " + p.Name);
                    executeProject(p);
                });

                _summary.WriteFile(_resultsFile);

                return createFinalResult();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                throw;
            }
        }
开发者ID:GaryLCoxJr,项目名称:storyteller,代码行数:31,代码来源:ProjectRunner.cs

示例3: Send

 public void Send(IList<MobileItem> items)
 {
     items.Each(mobileItem =>
     {
         var result = service.SendSingleMessage(categoryId, mobileItem.MobileNumber, mobileItem.MobileMessage);
         if (result.ResultNo != 0)
             AppInfoCenterService.LoggingService.Error(AlarmConfigurationBase.ModuleName, "MailService", "Send", 
                 string.Format("发送短信出错,发送结果代码:{0}", result.ToString()));
     });
 }
开发者ID:yhhno,项目名称:Adhesive,代码行数:10,代码来源:MobileService.cs

示例4: SetUp

 public void SetUp()
 {
     documentStore = new EmbeddableDocumentStore {RunInMemory = true}.Initialize();
     presentations = Builder<Presentation>.CreateListOfSize(5)
                                         .TheFirst(1).With(x => x.PresentationDate = DateTime.Today.AddDays(-1))
                                         .With(x => x.Booked = true)
                                         .TheNext(4).With(x => x.PresentationDate > DateTime.Today)
                                         .With(x => x.Booked = true)
                                         .TheLast(1).With(x => x.Booked = false)
                                         .Build();
     var session = documentStore.OpenSession();
     presentations.Each(session.Store);
     session.SaveChanges();
 }
开发者ID:cfuess,项目名称:Public-Site,代码行数:14,代码来源:HomeControllerTests.cs

示例5: PersistentTaskController

        public PersistentTaskController(ChannelGraph graph, ILogger logger, ITaskMonitoringSource factory, IList<IPersistentTaskSource> sources)
        {
            _graph = graph;
            _logger = logger;
            _factory = factory;
            sources.Each(x => _sources[x.Protocol] = x);

            _agents.OnMissing = uri => {
                var persistentTask = FindTask(uri);
                return persistentTask == null ? null : _factory.BuildAgentFor(persistentTask);
            };

            _permanentTasks = sources.SelectMany(x => x.PermanentTasks()).ToArray();
        }
开发者ID:RyanHauert,项目名称:fubumvc,代码行数:14,代码来源:PersistentTaskController.cs

示例6: Send

 public void Send(IList<MailItem> items)
 {
     items.Each(mailItem =>
     {
         Message message = new Message();
         message.BodyHtml = mailItem.MailBody;
         message.Subject = mailItem.MailTitle;
         message.Charset = Encoding.UTF8;
         message.From = new Address(username, "Adhesive框架邮件服务");
         message.To = new AddressList() { mailItem.MailAddress };
         try
         {
             Smtp.Send(message, hostName, 25, "5173.com", SmtpAuthentication.Any, username, password);
         }
         catch (Exception ex)
         {
             ex.Handle(AlarmConfigurationBase.ModuleName, "MailService", "Send");
         }
     });
 }
开发者ID:yhhno,项目名称:Adhesive,代码行数:20,代码来源:MailService.cs

示例7: Store

        /// <summary>
        /// Stores the specified web assets with the specified details.
        /// </summary>
        /// <param name="contentType">Type of the content.</param>
        /// <param name="version">The version.</param>
        /// <param name="compress">if set to <c>true</c> [compress].</param>
        /// <param name="cacheDurationInDays">The cache duration in days.</param>
        /// <param name="items">The items.</param>
        /// <returns>Returns the id.</returns>
        public string Store(string contentType, string version, bool compress, float cacheDurationInDays, IList<string> items)
        {
            Guard.IsNotNullOrEmpty(contentType, "contentType");
            Guard.IsNotNullOrEmpty(version, "version");
            Guard.IsNotNegative(cacheDurationInDays, "cacheDurationInDays");
            Guard.IsNotNullOrEmpty(items, "items");
            items.Each(item => Guard.IsNotVirtualPath(item, "item"));

            MergedAsset mergedAsset = CreateMergedAssetWith(contentType, version, compress, cacheDurationInDays, items);
            string id = CreateIdFrom(mergedAsset);

            EnsureAsset(mergedAsset, id);

            return id;
        }
开发者ID:timbooker,项目名称:telerikaspnetmvc,代码行数:24,代码来源:WebAssetRegistry.cs

示例8: Alter

        protected override void Alter(IList<Country> entities)
        {
            base.Alter(entities);

            entities.Each(x => x.Published = false);

            entities.WithKey(x => x.NumericIsoCode)

            .Alter(276, x =>
            {
                x.Name = "Deutschland";
                x.DisplayOrder = -10;
                x.Published = true;
                #region Provinces
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Baden-Württemberg",
                    Abbreviation = "BW",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Bayern",
                    Abbreviation = "BY",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Berlin",
                    Abbreviation = "BE",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Brandenburg",
                    Abbreviation = "BB",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Bremen",
                    Abbreviation = "HB",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Hamburg",
                    Abbreviation = "HH",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Hessen",
                    Abbreviation = "HE",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Mecklenburg-Vorpommern",
                    Abbreviation = "MV",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Niedersachsen",
                    Abbreviation = "NI",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Nordrhein-Westfalen",
                    Abbreviation = "NW",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Rheinland-Pfalz",
                    Abbreviation = "RP",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
                    Name = "Saarland",
                    Abbreviation = "SL",
                    Published = true,
                    DisplayOrder = 1,
                });
                x.StateProvinces.Add(new StateProvince()
                {
//.........这里部分代码省略.........
开发者ID:GloriousOnion,项目名称:SmartStoreNET,代码行数:101,代码来源:DeDESeedData.cs


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