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


C# IList.ForEach方法代码示例

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


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

示例1: Append

 /// <summary>
 /// Function to append errors in validation error dictionary.
 /// </summary>
 /// <param name="errorsDictionary">Errors dictionary</param>
 /// <param name="errors">List of errors</param>
 public static void Append(this Dictionary<string, string> errorsDictionary, IList<ErrorListItem> errors)
 {
     if (errors != null)
     {
         errors.ForEach(item => Append(errorsDictionary, item));
     }
 }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:12,代码来源:ValidationErrorExtensions.cs

示例2: PopulateProperties

 private void PopulateProperties( GraphicStructure paletteStructure, IList<GraphicStructure> pixelStructures )
 {
     Palette = new Palette( paletteStructure.Pixels, Palette.ColorDepth._16bit );
     List<byte> pix = new List<byte>();
     pixelStructures.ForEach( p => pix.AddRange( p.Pixels ) );
     Pixels = pix.AsReadOnly();
 }
开发者ID:Glain,项目名称:FFTPatcher,代码行数:7,代码来源:WldTex2.cs

示例3: get_lines

 private static string get_lines(IList<FinishedAndRawInventoryCounted> counteds)
 {
     var retVal = "Dell Part Number	Available FG Qty	Available RAW Qty\r\n";
     counteds.ForEach(
         i => retVal += get_line(i) + "\r\n");
     return retVal;
 }
开发者ID:agglerithm,项目名称:FluentSytelineInterface,代码行数:7,代码来源:CommonExtensions.cs

示例4: FillActiveUserFilesListView

        public static void FillActiveUserFilesListView(IList<ActiveUserFile> activeUserFiles, ListView target)
        {
            target.Items.Clear();
            target.Columns.Clear();
            target.Columns.Add("File Name");
            target.Columns.Add("Reference Computer");
            target.Columns.Add("Memory Use");
            target.Columns.Add("CPU Use");
            target.Columns.Add("Description");

            IList<String> images = new List<string>();
            images.Add("TrendWinForm.Images.Icons.File_byJesse_48.png");
            PopulateListViewImages(images, target);
            activeUserFiles.ForEach(auf =>
            {
                var item = new ListViewItem(auf.ReferenceComputer.ToString());
                item.Text = auf.FileName;
                item.SubItems.Add(auf.ReferenceComputer.Make + " " + auf.ReferenceComputer.Model);
                item.SubItems.Add(auf.MemoryUsage.ToString());
                item.SubItems.Add(auf.CpuUsage.ToString());
                item.SubItems.Add(auf.Description);
                item.ImageIndex = 0;
                target.Items.Add(item);
            });
        }
开发者ID:the-simian,项目名称:TREND-Application,代码行数:25,代码来源:EntitiesToListView.cs

示例5: GetContryDetailsModel

        protected IList<ICountryDetails> GetContryDetailsModel(IList<Country> countries)
        {
            var contryDetails = new List<ICountryDetails>();
            countries.ForEach(c => contryDetails.Add(GetContryDetailsModel(c)));

            return contryDetails;
        }
开发者ID:erikaspl,项目名称:WhoScored,代码行数:7,代码来源:WhoScoredControllerBase.cs

示例6: AddBuildings

 private void AddBuildings(TreeViewItem projectItem, IList<Web.Models.Building> buildings)
 {
     buildings.ForEach(b =>
                           {
                               var buildingItem = new TreeViewItem() { };
                               View1.Items.Add(projectItem);
                           });
 }
开发者ID:dimpapadim3,项目名称:NErgyPlatformSample,代码行数:8,代码来源:TreeViewControllerKenak.cs

示例7: CopyValidationErrors

        /// <summary>
        /// Copies the validation errors.
        /// </summary>
        /// <param name="modelState">State of the model.</param>
        /// <param name="validationErrors">The validation errors.</param>
        public static void CopyValidationErrors(this ModelStateDictionary modelState, IList<ValidationError> validationErrors)
        {
            validationErrors.ForEach(error => modelState.AddModelError(error.Property, /* strValue, */ error.Message));

            //string strValue = null;
                //if (error.AttemptedValue != null)
                //    strValue = error.AttemptedValue.ToString();
        }
开发者ID:jd-pantheon,项目名称:Titan-Framework-v2,代码行数:13,代码来源:ModelStateDictionaryExtensions.cs

示例8: AskOrBoolReturnHooks

 private static bool AskOrBoolReturnHooks(CommandArgs args, IList<Func<CommandArgs, bool>> hooks)
 {
     bool ret = false;
     hooks.ForEach(delegate(Func<CommandArgs, bool> a){
         ret |= a(args);
     });
     return ret;
 }
开发者ID:mawize,项目名称:Boxes,代码行数:8,代码来源:BoxesHooks.cs

示例9: EncodeNodes

 private static IEnumerable<NodeData> EncodeNodes(
      IList<ExplorationNode> nodes,
      Dictionary<ExplorationEdge, uint> edgeToId)
 {
     List<NodeData> nodeData = new List<NodeData>();
     nodes.ForEach(
         (node) => nodeData.Add(new NodeData(node, edgeToId)));
     return nodeData.OrderBy((node) => node.NodeId);
 }
开发者ID:fgeraci,项目名称:CS195-Core,代码行数:9,代码来源:SpaceData.cs

示例10: Scan

 public IList<Token> Scan(IList<Token> tokens, Options options)
 {
     tokens.ForEach(token => token.Tag(
         new ITag[]
             {
                 ScanOrdinal(token, options),
                 ScanOrdinalDay(token)
             }.Where(
                 x => x != null).ToList()));
     return tokens;
 }
开发者ID:acsteitz,项目名称:nChronic,代码行数:11,代码来源:OrdinalScanner.cs

示例11: BuildGenusTypeDictionary

        private IDictionary<GenusTypeDto, PhotoDto> BuildGenusTypeDictionary(IList<GenusTypeDto> dtoList)
        {
            var dictionary = new Dictionary<GenusTypeDto, PhotoDto>();

            dtoList.ForEach(x =>
                {
                    var photo = this.photosRepository.GetSingleForGenusType(x.Id);

                    dictionary.Add(x, photo == null ? null : DtoFactory.Build(photo));
                });

            return dictionary;
        }
开发者ID:Dakuan,项目名称:RiftData,代码行数:13,代码来源:HomeIndexPageViewModelFactory.cs

示例12: OrderLine

        public OrderLine(Product product, int quantity, IList<Outcome> outcomes):this()
        {
            Product = product;
            Quantity = quantity;
            Price = product.Price;
            ProductName = product.Name;

            Outcomes = outcomes;
            outcomes.ForEach(x => x.OrderLine = this);

            Profit = Outcomes.Sum(outcome => outcome.Profit);
            SummWithDiscount = Outcomes.Sum(outcome => outcome.SummWithDiscount);

        }
开发者ID:Phidel,项目名称:elfam,代码行数:14,代码来源:OrderLine.cs

示例13: ParseResult

        public void ParseResult(IList<string> lines)
        {
            lines.ForEach(l =>
            {
                if (l.StartsWith("dangling commit "))
                {
                    var commit = new BareCommitResult();
                    commit.ParseResult(new List<string>() { l.Remove(0, l.LastIndexOf(" ", StringComparison.Ordinal) + 1)});

                    Commits.Add(commit);
                }
            });
        }
开发者ID:Thulur,项目名称:GitStatisticsAnalyzer,代码行数:13,代码来源:DanglingCommitResult.cs

示例14: InteractiveTests

        public InteractiveTests()
        {
            InitializeComponent();

            _tests = AllTypes.InCurrentAssembly()
                .Where(x => x.IsConcrete() && x.IsAssignableTo<UiTest>())
                .Select(x => (UiTest)Activator.CreateInstance(x))
                .ToList();

            _tests
                .ForEach(x => x.Owner = this);

            _tests.Select(x => x.Module)
                .Distinct()
                .ForEach(x => _moduleNames.Add(x));

            _modules.DataSource = _moduleNames.ToList() ;
        }
开发者ID:scaredfinger,项目名称:ActiveWidgets,代码行数:18,代码来源:InteractiveTests.cs

示例15: Compress

        /// <summary>
        /// Compresses the specified file.
        /// </summary>
        /// <typeparam name="T">Must be <see cref="IStringSectioned"/> and <see cref="ICompressed"/></typeparam>
        /// <param name="file">The file to compress.</param>
        /// <param name="ignoreSections">A dictionary indicating which entries to not compress, with each key being the section that contains the ignored
        /// entries and each item in the value being an entry to ignore</param>
        /// <param name="callback">The progress callback.</param>
        public static CompressionResult Compress( IList<IList<string>> sections, byte terminator, GenericCharMap charmap, IList<bool> allowedSections )
        {
            int length = 0;
            sections.ForEach( s => length += charmap.StringsToByteArray( s, terminator ).Length );

            byte[] result = new byte[length];
            int[] lengths = new int[sections.Count];

            int pos = 0;
            for( int section = 0; section < sections.Count; section++ )
            {
                int oldPos = pos;

                if ( allowedSections == null || allowedSections[section] )
                {
                    CompressSection( charmap.StringsToByteArray( sections[section], terminator ), result, ref pos );
                }
                else
                {
                    byte[] secResult = charmap.StringsToByteArray( sections[section], terminator );
                    secResult.CopyTo( result, pos );
                    pos += secResult.Length;
                }

                lengths[section] = pos - oldPos;

            }

            return new CompressionResult( result.Sub( 0, pos - 1 ), lengths );
        }
开发者ID:Glain,项目名称:FFTPatcher,代码行数:38,代码来源:TextUtilities.cs


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