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


C# ImmutableDictionary.Remove方法代码示例

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


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

示例1: ImmutableDictionary_RemoveTest

 public void ImmutableDictionary_RemoveTest()
 {
     Dictionary<int, string> dictionary = new Dictionary<int, string>
     {
         {1,"asaas"},
         {2,"sasas"},
         {3,"tak"}
     };
     ImmutableDictionary<int, string> test = new ImmutableDictionary<int, string>(dictionary);
     test.Remove(2);
 }
开发者ID:powermedia,项目名称:PowerMedia.Common,代码行数:11,代码来源:ImmutableCollectionsTests.cs

示例2: DiagnosticAnalyzerMap

                    public DiagnosticAnalyzerMap(HostAnalyzerManager analyzerManager, string language, ImmutableDictionary<DiagnosticAnalyzer, StateSet> analyzerMap)
                    {
                        // hold directly on to compiler analyzer
                        _compilerAnalyzer = analyzerManager.GetCompilerDiagnosticAnalyzer(language);

                        // in test case, we might not have the compiler analyzer.
                        if (_compilerAnalyzer == null)
                        {
                            _map = analyzerMap;
                            return;
                        }

                        _compilerStateSet = analyzerMap[_compilerAnalyzer];

                        // hold rest of analyzers
                        _map = analyzerMap.Remove(_compilerAnalyzer);
                    }
开发者ID:Rickinio,项目名称:roslyn,代码行数:17,代码来源:DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs

示例3: RemoveSyntaxTreeFromDeclarationMapAndTable

        private static void RemoveSyntaxTreeFromDeclarationMapAndTable(
            SyntaxTree tree,
            ref ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMap,
            ref DeclarationTable declTable,
            ref bool referenceDirectivesChanged)
        {
            Lazy<RootSingleNamespaceDeclaration> lazyRoot;
            if (!declMap.TryGetValue(tree, out lazyRoot))
            {
                throw new ArgumentException(string.Format(CSharpResources.SyntaxTreeNotFoundTo, tree), "trees");
            }

            declTable = declTable.RemoveRootDeclaration(lazyRoot);
            declMap = declMap.Remove(tree);
            referenceDirectivesChanged = referenceDirectivesChanged || tree.HasReferenceDirectives();
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:16,代码来源:CSharpCompilation.cs

示例4: RemoveOldTreeFromMap

                private static ImmutableDictionary<DocumentId, SyntaxTree> RemoveOldTreeFromMap(
                    Compilation newCompilation,
                    ImmutableDictionary<DocumentId, SyntaxTree> oldMap, ImmutableDictionary<DocumentId, SyntaxTree> map,
                    CancellationToken cancellationToken)
                {
                    foreach (var oldIdAndTree in oldMap)
                    {
                        cancellationToken.ThrowIfCancellationRequested();

                        // check whether new compilation still has the tree
                        if (newCompilation.ContainsSyntaxTree(oldIdAndTree.Value))
                        {
                            continue;
                        }

                        var documentId = oldIdAndTree.Key;

                        // check whether the tree has been updated
                        SyntaxTree currentTree;
                        if (!map.TryGetValue(documentId, out currentTree) ||
                            currentTree != oldIdAndTree.Value)
                        {
                            continue;
                        }

                        // this has been removed
                        map = map.Remove(documentId);
                    }

                    return map;
                }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:31,代码来源:SemanticModelWorkspaceServiceFactory.cs

示例5: ParseDocumentAsync

        private void ParseDocumentAsync(Document document)
        {
            var cancellationTokenSource = new CancellationTokenSource();

            using (_stateLock.DisposableWrite())
            {
                _workMap = _workMap.Add(document.Id, cancellationTokenSource);
            }

            var cancellationToken = cancellationTokenSource.Token;

            var task = _taskScheduler.ScheduleTask(
                () => document.GetSyntaxTreeAsync(cancellationToken),
                "BackgroundParser.ParseDocumentAsync",
                cancellationToken);

            // Always ensure that we mark this work as done from the workmap.
            task.SafeContinueWith(
                _ =>
                {
                    using (_stateLock.DisposableWrite())
                    {
                        _workMap = _workMap.Remove(document.Id);
                    }
                }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Default);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:26,代码来源:BackgroundParser.cs

示例6: Add_Test

 public void Add_Test()
 {
 	Dictionary<int, string> _dictionary = new Dictionary<int, string>
     {
         {1, "aabb"},
         {2, "bbcc"},
         {3, "ccdd"}
     };
 	ImmutableDictionary<int, string> _immutableDictionary = new ImmutableDictionary<int, string>(_dictionary);
 	_immutableDictionary.Remove(new KeyValuePair<int, string>(1, "aabb"));
 }
开发者ID:powermedia,项目名称:PowerMedia.Common,代码行数:11,代码来源:ImmutableCollectionsTests.cs

示例7: RemoveCandidateIfParamDefault

        private ImmutableDictionary<String, ParameterSet> RemoveCandidateIfParamDefault(
            ImmutableDictionary<String, ParameterSet> candidates,
            Parameter parameter
        )
        {
            if (parameter.IsCommonParameter)
            {
                Logger.Debug(
                    "Skipping common parameter {Parameter}",
                    parameter.Name
                );

                return candidates;
            }

            if (parameter.HasDefaultValue(Target))
            {
                Logger.Debug(
                    "Parameter {Parameter} has default value, removing {ParameterSetName} from candidates",
                    parameter.Name,
                    parameter.ParameterSetName
                );

                return candidates.Remove(
                    parameter.ParameterSetName
                );
            }

            Logger.Debug(
                "Parameter {Parameter} has a value set, keeping {ParameterSetName} as a candidate",
                parameter.Name,
                parameter.ParameterSetName
            );

            return candidates;
        }
开发者ID:NaseUkolyCZ,项目名称:HarshPoint,代码行数:36,代码来源:ParameterSetResolver.cs


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