本文整理汇总了C#中ImmutableArray.ForEach方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableArray.ForEach方法的具体用法?C# ImmutableArray.ForEach怎么用?C# ImmutableArray.ForEach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableArray
的用法示例。
在下文中一共展示了ImmutableArray.ForEach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertFiles
static void AssertFiles(ImmutableArray<TestFile> files, TestEnvironment environment, bool ignoreEmptyLines) {
files.ForEach(file => {
var actualText = environment.ReadText(file.Name);
if(ignoreEmptyLines)
actualText = actualText.RemoveEmptyLines();
Assert.Equal(file.Text, actualText);
});
}
示例2: SetParentSectionAndNotebook
private ImmutableArray<PageDto> SetParentSectionAndNotebook(ImmutableArray<PageDto> pages, SectionDto section)
{
pages.ForEach(page =>
{
page.ParentSection = section;
page.ParentNotebook = section.ParentNotebook;
});
return pages;
}
示例3: AssertMultipleFilesResult
static void AssertMultipleFilesResult(ImmutableArray<TestFile> input, Action<GeneratorResult, TestEnvironment> assertion, BuildConstants buildConstants) {
var testEnvironment = CreateEnvironment(buildConstants);
input.ForEach(file => testEnvironment.Environment.WriteText(file.Name, file.Text));
var result = Generator.Generate(input.Where(file => file.IsInFlow).Select(file => file.Name).ToImmutableArray(), testEnvironment.Environment);
AssertFiles(input, testEnvironment, ignoreEmptyLines: false);
assertion(result, testEnvironment);
}
示例4: SetNotebookSections
private void SetNotebookSections(ImmutableArray<NotebookDto> notebooks, IActorRef originalSender)
{
var sectionActor = Context.ActorOf(ActorRegistry.Section);
var getSectionsForNotebookTasks = new List<Task<NotebookDto>>();
notebooks.ForEach(notebook =>
{
var task = _section.GetSectionsForNotebook(sectionActor, notebook).ContinueWith(sectionsTask =>
{
var sections = sectionsTask.Result;
notebook.AddSections(sections);
return notebook;
});
getSectionsForNotebookTasks.Add(task);
});
Task.WhenAll(getSectionsForNotebookTasks).ContinueWith(notebooksWithSectionsTask =>
{
var notebooksWithSections = notebooksWithSectionsTask.Result.ToImmutableArray();
return new Internal.SetNotebookSectionsResult(notebooksWithSections, originalSender);
}).PipeTo(Self);
}