本文整理汇总了C#中ImmutableList.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableList.AddRange方法的具体用法?C# ImmutableList.AddRange怎么用?C# ImmutableList.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableList
的用法示例。
在下文中一共展示了ImmutableList.AddRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompilationDocument
// --- Initialization ---
/// <summary>
/// Initializes a new compilation document from a list of text lines.
/// This method does not scan the inserted text lines to produce tokens.
/// You must explicitely call UpdateTokensLines() to start an initial scan of the document.
/// </summary>
public CompilationDocument(TextSourceInfo textSourceInfo, IEnumerable<ITextLine> initialTextLines, TypeCobolOptions compilerOptions, IProcessedTokensDocumentProvider processedTokensDocumentProvider)
{
TextSourceInfo = textSourceInfo;
CompilerOptions = compilerOptions;
this.processedTokensDocumentProvider = processedTokensDocumentProvider;
// Initialize the compilation document lines
compilationDocumentLines = ImmutableList<CodeElementsLine>.Empty.ToBuilder();
// ... with the initial list of text lines received as a parameter
if (initialTextLines != null)
{
// Insert Cobol text lines in the internal tree structure
compilationDocumentLines.AddRange(initialTextLines.Select(textLine => CreateNewDocumentLine(textLine, textSourceInfo.ColumnsLayout)));
}
// Initialize document views versions
currentTextLinesVersion = new DocumentVersion<ICobolTextLine>(this);
currentTokensLinesVersion = new DocumentVersion<ITokensLine>(this);
// Initialize performance stats
PerfStatsForText = new PerfStatsForCompilationStep(CompilationStep.Text);
PerfStatsForScanner = new PerfStatsForCompilationStep(CompilationStep.Scanner);
PerfStatsForPreprocessor = new PerfStatsForCompilationStep(CompilationStep.Preprocessor);
}
示例2: AddRange_ReturnsNewListWithNewItemsAppended
public void AddRange_ReturnsNewListWithNewItemsAppended()
{
var subject = new ImmutableList<int>();
var result = subject.AddRange(Enumerable.Range(1, 10));
Assert.AreEqual(0, subject.Count);
Assert.AreEqual(10, result.Count);
}
示例3: CachedOperatorTypeLoader
static CachedOperatorTypeLoader()
{
var allOperatorTypeLoader = new OperatorTypeLoader();
var types = allOperatorTypeLoader.LoadOperatorTypes();
var operators = types.Select(allOperatorTypeLoader.LoadOperator);
_cachedTypes = _cachedTypes.AddRange(types);
_cachedOperators = _cachedOperators.AddRange(operators);
AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => {
try {
var operatorTypeLoader = new OperatorTypeLoader();
var newAssemblyTypes = operatorTypeLoader.LoadOperatorTypes(args.LoadedAssembly);
var newOperators = newAssemblyTypes.Select(operatorTypeLoader.LoadOperator);
_cachedTypes = _cachedTypes.AddRange(newAssemblyTypes);
_cachedOperators = _cachedOperators.AddRange(newOperators);
} catch (Exception e) {
NLog.LogManager.GetCurrentClassLogger().Error(e, "Loading operators from a new assembly failed");
}
};
}