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


C# IImmutableSet类代码示例

本文整理汇总了C#中IImmutableSet的典型用法代码示例。如果您正苦于以下问题:C# IImmutableSet类的具体用法?C# IImmutableSet怎么用?C# IImmutableSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: FindDocumentsAsync

        protected async Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IImmutableSet<Document> scope, Func<Document, CancellationToken, Task<bool>> predicateAsync, CancellationToken cancellationToken)
        {
            // special case for HR
            if (scope != null && scope.Count == 1)
            {
                var document = scope.First();
                if (document.Project == project)
                {
                    return scope.ToImmutableArray();
                }

                return ImmutableArray<Document>.Empty;
            }

            var documents = ArrayBuilder<Document>.GetInstance();
            foreach (var document in project.Documents)
            {
                if (scope != null && !scope.Contains(document))
                {
                    continue;
                }

                if (await predicateAsync(document, cancellationToken).ConfigureAwait(false))
                {
                    documents.Add(document);
                }
            }

            return documents.ToImmutableAndFree();
        }
开发者ID:tralivali1234,项目名称:roslyn,代码行数:30,代码来源:AbstractReferenceFinder.cs

示例2: FindReferencesInServiceProcessAsync

        private static async Task FindReferencesInServiceProcessAsync(
            SymbolAndProjectId symbolAndProjectId,
            Solution solution,
            IStreamingFindReferencesProgress progress,
            IImmutableSet<Document> documents,
            CancellationToken cancellationToken)
        {
            var client = await solution.Workspace.GetRemoteHostClientAsync(cancellationToken).ConfigureAwait(false);
            if (client == null)
            {
                await FindReferencesInCurrentProcessAsync(
                    symbolAndProjectId, solution, progress, documents, cancellationToken).ConfigureAwait(false);
                return;
            }

            // Create a callback that we can pass to the server process to hear about the 
            // results as it finds them.  When we hear about results we'll forward them to
            // the 'progress' parameter which will then upate the UI.
            var serverCallback = new ServerCallback(solution, progress, cancellationToken);

            using (var session = await client.CreateCodeAnalysisServiceSessionAsync(
                solution, serverCallback, cancellationToken).ConfigureAwait(false))
            {
                await session.InvokeAsync(
                    nameof(IRemoteSymbolFinder.FindReferencesAsync),
                    SerializableSymbolAndProjectId.Dehydrate(symbolAndProjectId),
                    documents?.Select(SerializableDocumentId.Dehydrate).ToArray()).ConfigureAwait(false);
            }
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:29,代码来源:SymbolFinder_Remote.cs

示例3: MetadataDefinitionState

 public MetadataDefinitionState(MetadataDefinitionName name, IDataType datatype, string regex, IImmutableSet<AllowableValue> allowedValues)
     : this(name, datatype,regex)
 {
     _allowedValues = allowedValues;
     CreatedUtcDate = DateTime.UtcNow;
     IsDeleted = false;
 }
开发者ID:brucewu16899,项目名称:lacjam,代码行数:7,代码来源:MetadataDefinitionState.cs

示例4: FindDerivedClassesAsync

        private static Task<IEnumerable<INamedTypeSymbol>> FindDerivedClassesAsync(
            INamedTypeSymbol type,
            Solution solution,
            IImmutableSet<Project> projects, 
            bool transitive,
            CancellationToken cancellationToken)
        {
            if (s_isNonSealedClass(type))
            {
                Func<HashSet<INamedTypeSymbol>, INamedTypeSymbol, bool> metadataTypeMatches =
                    (set, metadataType) => TypeDerivesFrom(set, metadataType, transitive);

                Func<HashSet<INamedTypeSymbol>, INamedTypeSymbol, bool> sourceTypeImmediatelyMatches =
                    (set, metadataType) => set.Contains(metadataType.BaseType?.OriginalDefinition);

                return FindTypesAsync(type, solution, projects,
                    metadataTypeMatches: metadataTypeMatches,
                    sourceTypeImmediatelyMatches: sourceTypeImmediatelyMatches,
                    shouldContinueSearching: s_isNonSealedClass,
                    transitive: transitive,
                    cancellationToken: cancellationToken);
            }

            return SpecializedTasks.EmptyEnumerable<INamedTypeSymbol>();
        }
开发者ID:natidea,项目名称:roslyn,代码行数:25,代码来源:DependentTypeFinder.cs

示例5: BuildUp

		public override IEnumerable<SlideBlock> BuildUp(BuildUpContext context, IImmutableSet<string> filesInProgress)
		{
			FillProperties(context);
			RemovedLabels = RemovedLabels ?? new Label[0];
			if (PreludeFile == null)
			{
				PreludeFile = context.CourseSettings.GetPrelude(LangId);
				if (PreludeFile != null)
					PreludeFile = Path.Combine("..", PreludeFile);
			}

			var code = context.FileSystem.GetContent(File);
			var regionRemover = new RegionRemover(LangId);
			var extractor = context.GetExtractor(File, LangId, code);

			var prelude = "";
			if (PreludeFile != null)
				prelude = context.FileSystem.GetContent(PreludeFile);

			var exerciseCode = regionRemover.Prepare(code);
			IEnumerable<Label> notRemoved;
			exerciseCode = regionRemover.Remove(exerciseCode, RemovedLabels, out notRemoved);
			int index;
			exerciseCode = regionRemover.RemoveSolution(exerciseCode, SolutionLabel, out index);
			index += prelude.Length;

			ExerciseInitialCode = ExerciseInitialCode.RemoveCommonNesting();
			ExerciseCode = prelude + exerciseCode;
			IndexToInsertSolution = index;
			EthalonSolution = extractor.GetRegion(SolutionLabel);
			ValidatorName = string.Join(" ", LangId, ValidatorName);

			yield return this;
		}
开发者ID:andgein,项目名称:uLearn,代码行数:34,代码来源:ExerciseBlock.cs

示例6: GetCommandStatusAsync

 public Task<CommandStatusResult> GetCommandStatusAsync(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, string commandText, CommandStatus progressiveStatus) {
     var workflow = _interactiveWorkflowProvider.GetOrCreate();
     if (commandId == RPackageCommandId.icmdCopyRemoteItemPath && nodes.IsSingleNodePath() && workflow.RSession.IsHostRunning && workflow.RSession.IsRemote) {
         return Task.FromResult(new CommandStatusResult(true, commandText, CommandStatus.Enabled | CommandStatus.Supported));
     }
     return Task.FromResult(CommandStatusResult.Unhandled);
 }
开发者ID:Microsoft,项目名称:RTVS,代码行数:7,代码来源:CopyRemoteItemPathCommand.cs

示例7: GetCommandStatus

        public CommandStatusResult GetCommandStatus(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, string commandText, CommandStatus progressiveStatus) {
            if ((VSConstants.VSStd2KCmdID)commandId == VSConstants.VSStd2KCmdID.EXCLUDEFROMPROJECT && nodes != null && nodes.Count > 0) {
                return new CommandStatusResult(true, commandText, CommandStatus.NotSupported | CommandStatus.Invisible);
            }

            return CommandStatusResult.Unhandled;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:7,代码来源:ExcludeFromProjectCommand.cs

示例8: GetDocumentHighlightsAsync

        public async Task<ImmutableArray<DocumentHighlights>> GetDocumentHighlightsAsync(
            Document document, int position, IImmutableSet<Document> documentsToSearch, CancellationToken cancellationToken)
        {
            // use speculative semantic model to see whether we are on a symbol we can do HR
            var span = new TextSpan(position, 0);
            var solution = document.Project.Solution;

            var semanticModel = await document.GetSemanticModelForSpanAsync(span, cancellationToken).ConfigureAwait(false);
            var symbol = await SymbolFinder.FindSymbolAtPositionAsync(
                semanticModel, position, solution.Workspace, cancellationToken).ConfigureAwait(false);
            if (symbol == null)
            {
                return ImmutableArray<DocumentHighlights>.Empty;
            }

            symbol = await GetSymbolToSearchAsync(document, position, semanticModel, symbol, cancellationToken).ConfigureAwait(false);
            if (symbol == null)
            {
                return ImmutableArray<DocumentHighlights>.Empty;
            }

            // Get unique tags for referenced symbols
            return await GetTagsForReferencedSymbolAsync(
                new SymbolAndProjectId(symbol, document.Project.Id), documentsToSearch, 
                solution, cancellationToken).ConfigureAwait(false);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:26,代码来源:AbstractDocumentHighlightsService.cs

示例9: DetermineCascadedSymbolsAsync

        public async Task<IEnumerable<ISymbol>> DetermineCascadedSymbolsAsync(ISymbol symbol, Solution solution, IImmutableSet<Project> projects = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var linkedSymbols = new HashSet<ISymbol>();

            foreach (var location in symbol.DeclaringSyntaxReferences)
            {
                var originalDocument = solution.GetDocument(location.SyntaxTree);

                foreach (var linkedDocumentId in originalDocument.GetLinkedDocumentIds())
                {
                    var linkedDocument = solution.GetDocument(linkedDocumentId);
                    var linkedSyntaxRoot = await linkedDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
                    var linkedNode = linkedSyntaxRoot.FindNode(location.Span, getInnermostNodeForTie: true);

                    var semanticModel = await linkedDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                    var linkedSymbol = semanticModel.GetDeclaredSymbol(linkedNode, cancellationToken);

                    if (linkedSymbol != null &&
                        linkedSymbol.Kind == symbol.Kind &&
                        linkedSymbol.Name == symbol.Name &&
                        !linkedSymbols.Contains(linkedSymbol))
                    {
                        linkedSymbols.Add(linkedSymbol);
                    }
                }
            }

            return linkedSymbols;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:29,代码来源:LinkedFileReferenceFinder.cs

示例10: FindReferencesAsync

 /// <summary>
 /// Finds all references to a symbol throughout a solution
 /// </summary>
 /// <param name="symbol">The symbol to find references to.</param>
 /// <param name="solution">The solution to find references within.</param>
 /// <param name="documents">A set of documents to be searched. If documents is null, then that means "all documents".</param>
 /// <param name="cancellationToken">A cancellation token.</param>
 public static Task<IEnumerable<ReferencedSymbol>> FindReferencesAsync(
     ISymbol symbol,
     Solution solution,
     IImmutableSet<Document> documents,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return FindReferencesAsync(symbol, solution, progress: null, documents: documents, cancellationToken: cancellationToken);
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:15,代码来源:SymbolFinder_References.cs

示例11: EntityState

 private EntityState(Guid group, EntityName name, IImmutableSet<EntityValueSetState> values, bool deleted)
 {
     _group = group;
     _name = name;
     _values = values;
     LastModifiedUtcDate = DateTime.UtcNow;
     IsDeleted = deleted;
 }
开发者ID:brucewu16899,项目名称:lacjam,代码行数:8,代码来源:EntityState.cs

示例12: GetCommandStatus

 public CommandStatusResult GetCommandStatus(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, string commandText, CommandStatus progressiveStatus) {
     if (commandId == RPackageCommandId.icmdSetDirectoryHere && nodes.Count == 1) {
         var session = _interactiveWorkflowProvider.Active?.RSession;
         bool enabled = session != null && session.IsHostRunning && !session.IsRemote;
         return new CommandStatusResult(true, commandText, enabled ? CommandStatus.Enabled | CommandStatus.Supported : CommandStatus.Supported);
     }
     return CommandStatusResult.Unhandled;
 }
开发者ID:Microsoft,项目名称:RTVS,代码行数:8,代码来源:SetDirectoryHereCommand.cs

示例13: FindImplementingTypesAsync

 public static Task<IEnumerable<INamedTypeSymbol>> FindImplementingTypesAsync(
     this INamedTypeSymbol type,
     Solution solution,
     IImmutableSet<Project> projects,
     CancellationToken cancellationToken)
 {
     return DependentTypeFinder.FindImplementingTypesAsync(type, solution, projects, cancellationToken);
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:8,代码来源:INamedTypeSymbolExtensions.cs

示例14: Role

 public Role(int id, string name, string description, IImmutableSet<IRight> rights = null, PermissionsSource source = PermissionsSource.Manual)
 {
     this.Id = id;
     this.Name = name;
     this.Description = description;
     this.Rights = rights.DefaultIfNull();
     this.Source = source;
 }
开发者ID:Norhaven,项目名称:FluentBoilerplate,代码行数:8,代码来源:Role.cs

示例15: FindImplementedInterfaceMembersAsync

 /// <summary>
 /// Find symbols for declarations that implement members of the specified interface symbol
 /// </summary>
 public static async Task<IEnumerable<ISymbol>> FindImplementedInterfaceMembersAsync(
     ISymbol symbol, Solution solution, IImmutableSet<Project> projects = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     var result = await FindImplementedInterfaceMembersAsync(
         SymbolAndProjectId.Create(symbol, projectId: null),
         solution, projects, cancellationToken).ConfigureAwait(false);
     return result.SelectAsArray(s => s.Symbol);
 }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:11,代码来源:SymbolFinder_Hierarchy.cs


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