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


C# ImmutableList.AddRange方法代码示例

本文整理汇总了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);
        }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:31,代码来源:CompilationDocument.cs

示例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);
        }
开发者ID:gmf520,项目名称:Smocks,代码行数:8,代码来源:ImmutableListTests.cs

示例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");
                }
            };
        }
开发者ID:taneltumanski,项目名称:WebCalculator,代码行数:22,代码来源:CachedOperatorTypeLoader.cs


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