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


C# ImmutableHashSet.Contains方法代码示例

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


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

示例1: ShouldRunAnalyzerForStateType

        private static bool ShouldRunAnalyzerForStateType(DiagnosticAnalyzer analyzer, StateType stateTypeId,
            ImmutableHashSet<string> diagnosticIds = null, Func<DiagnosticAnalyzer, ImmutableArray<DiagnosticDescriptor>> getDescriptors = null)
        {
            if (diagnosticIds != null && getDescriptors(analyzer).All(d => !diagnosticIds.Contains(d.Id)))
            {
                return false;
            }

            switch (stateTypeId)
            {
                case StateType.Syntax:
                    return analyzer.SupportsSyntaxDiagnosticAnalysis();

                case StateType.Document:
                    return analyzer.SupportsSemanticDiagnosticAnalysis();

                case StateType.Project:
                    return analyzer.SupportsProjectDiagnosticAnalysis();

                default:
                    throw ExceptionUtilities.Unreachable;
            }
        }
开发者ID:nevinclement,项目名称:roslyn,代码行数:23,代码来源:DiagnosticIncrementalAnalyzer.cs

示例2: Filter

 /// <summary>
 /// Only the nodes that are in the <paramref name="includeNodes"/> set.
 /// </summary>
 public MetricsGossip Filter(ImmutableHashSet<Address> includeNodes)
 {
     return Copy(Nodes.Where(x => includeNodes.Contains(x.Address)).ToImmutableHashSet());
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:7,代码来源:ClusterMetricsCollector.cs

示例3: ShouldRunProviderForStateType

            private static bool ShouldRunProviderForStateType(StateType stateTypeId, DiagnosticAnalyzer provider, DiagnosticAnalyzerDriver driver,
                out bool supportsSemanticInSpan, ImmutableHashSet<string> diagnosticIds = null, Func<DiagnosticAnalyzer, ImmutableArray<DiagnosticDescriptor>> getDescriptor = null)
            {
                Debug.Assert(!IsAnalyzerSuppressed(provider, driver.Project.CompilationOptions, driver));

                supportsSemanticInSpan = false;
                if (diagnosticIds != null && getDescriptor(provider).All(d => !diagnosticIds.Contains(d.Id)))
                {
                    return false;
                }

                switch (stateTypeId)
                {
                    case StateType.Syntax:
                        return provider.SupportsSyntaxDiagnosticAnalysis(driver);

                    case StateType.Document:
                        return provider.SupportsSemanticDiagnosticAnalysis(driver, out supportsSemanticInSpan);

                    case StateType.Project:
                        return provider.SupportsProjectDiagnosticAnalysis(driver);

                    default:
                        throw ExceptionUtilities.Unreachable;
                }
            }
开发者ID:JinGuoGe,项目名称:roslyn,代码行数:26,代码来源:DiagnosticAnalyzerService.IncrementalAnalyzer.cs

示例4: GetFilteredDiagnosticsAsync

        private static async Task<ImmutableArray<Diagnostic>> GetFilteredDiagnosticsAsync(Task<IEnumerable<Diagnostic>> getDiagnosticsTask, ImmutableHashSet<string> diagnosticIds)
        {
            if (getDiagnosticsTask != null)
            {
                var diagnostics = await getDiagnosticsTask.ConfigureAwait(false);
                if (diagnostics != null)
                {
                    return diagnostics.Where(d => d != null && diagnosticIds.Contains(d.Id)).ToImmutableArray();
                }
            }

            return ImmutableArray<Diagnostic>.Empty;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:13,代码来源:FixAllContext.cs

示例5: AddNonLocalDiagnostics

        private static void AddNonLocalDiagnostics(
            ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics,
            ImmutableHashSet<DiagnosticAnalyzer> excludedAnalyzers,
            ImmutableArray<Diagnostic>.Builder builder)
        {
            foreach (var diagnosticsByAnalyzer in nonLocalDiagnostics)
            {
                if (excludedAnalyzers.Contains(diagnosticsByAnalyzer.Key))
                {
                    continue;
                }

                builder.AddRange(diagnosticsByAnalyzer.Value);
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:15,代码来源:AnalysisResult.cs

示例6: RemoveSymbolNamesFromSourceText

        private static SourceText RemoveSymbolNamesFromSourceText(SourceText sourceText, ImmutableHashSet<string> linesToRemove)
        {
            if (linesToRemove.IsEmpty)
            {
                return sourceText;
            }

            HashSet<string> lines = GetLinesFromSourceText(sourceText);
            var newLines = lines.Where(line => !linesToRemove.Contains(line));

            IOrderedEnumerable<string> sortedLines = newLines.OrderBy(s => s, StringComparer.Ordinal);

            SourceText newSourceText = sourceText.Replace(new TextSpan(0, sourceText.Length), string.Join(Environment.NewLine, sortedLines));
            return newSourceText;
        }
开发者ID:bkoelman,项目名称:roslyn-analyzers,代码行数:15,代码来源:DeclarePublicAPIFix.cs

示例7: SatisfiesRole

 private bool SatisfiesRole(ImmutableHashSet<string> memberRoles)
 {
     if (string.IsNullOrEmpty(Settings.UseRole)) return true;
     return memberRoles.Contains(Settings.UseRole);
 }
开发者ID:rodrigovidal,项目名称:akka.net,代码行数:5,代码来源:ClusterRoutingConfig.cs

示例8: GetDiagnosticsForIdsAsync

 public override async Task<ImmutableArray<DiagnosticData>> GetDiagnosticsForIdsAsync(Solution solution, ProjectId projectId = null, DocumentId documentId = null, ImmutableHashSet<string> diagnosticIds = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     var diagnostics = await GetDiagnosticsAsync(solution, projectId, documentId, cancellationToken).ConfigureAwait(false);
     return diagnostics.Where(d => diagnosticIds.Contains(d.Id)).ToImmutableArrayOrEmpty();
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:5,代码来源:DiagnosticIncrementalAnalyzer.cs

示例9: ShouldRunAnalyzerForStateTypeAsync

        private static async Task<bool> ShouldRunAnalyzerForStateTypeAsync(DiagnosticAnalyzerDriver driver, DiagnosticAnalyzer analyzer, StateType stateTypeId,
            ImmutableHashSet<string> diagnosticIds = null, Func<DiagnosticAnalyzer, ImmutableArray<DiagnosticDescriptor>> getDescriptors = null)
        {
            Debug.Assert(!driver.IsAnalyzerSuppressed(analyzer));

            if (diagnosticIds != null && getDescriptors(analyzer).All(d => !diagnosticIds.Contains(d.Id)))
            {
                return false;
            }

            switch (stateTypeId)
            {
                case StateType.Syntax:
                    return await analyzer.SupportsSyntaxDiagnosticAnalysisAsync(driver).ConfigureAwait(false);

                case StateType.Document:
                    return await analyzer.SupportsSemanticDiagnosticAnalysisAsync(driver).ConfigureAwait(false);

                case StateType.Project:
                    return await analyzer.SupportsProjectDiagnosticAnalysisAsync(driver).ConfigureAwait(false);

                default:
                    throw ExceptionUtilities.Unreachable;
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:25,代码来源:DiagnosticIncrementalAnalyzer.cs

示例10: IsFieldRelevant

 private static bool IsFieldRelevant(IFieldSymbol fieldSymbol, ImmutableHashSet<IFieldSymbol> fieldsOfClass)
 {
     return fieldSymbol != null &&
         !fieldSymbol.IsConst &&
         !fieldSymbol.IsReadOnly &&
         fieldsOfClass.Contains(fieldSymbol);
 }
开发者ID:duncanpMS,项目名称:sonarlint-vs,代码行数:7,代码来源:GetHashCodeMutable.cs

示例11: GetImmutable

        private static ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> GetImmutable(
            ImmutableHashSet<DiagnosticAnalyzer> analyzers,
            Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder> nonLocalDiagnosticsOpt)
        {
            if (nonLocalDiagnosticsOpt == null)
            {
                return ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>.Empty;
            }

            var builder = ImmutableDictionary.CreateBuilder<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>();
            foreach (var diagnosticsByAnalyzer in nonLocalDiagnosticsOpt)
            {
                if (analyzers.Contains(diagnosticsByAnalyzer.Key))
                {
                    builder.Add(diagnosticsByAnalyzer.Key, diagnosticsByAnalyzer.Value.ToImmutable());
                }
            }

            return builder.ToImmutable();
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:20,代码来源:AnalysisResultBuilder.cs

示例12: RemoveObservers

 public Reachability RemoveObservers(ImmutableHashSet<UniqueAddress> nodes)
 {
     if (nodes.Count == 0)
     {
         return this;
     }
     else
     {
         var newRecords = _records.FindAll(r => !nodes.Contains(r.Observer));
         if (newRecords.Count == _records.Count)
         {
             return this;
         }
         else
         {
             var newVersions = _versions.RemoveRange(nodes);
             return new Reachability(newRecords, newVersions);
         }
     }
 }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:20,代码来源:Reachability.cs


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