• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISymbol类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SourceDefinitionTreeItem

        public SourceDefinitionTreeItem(Document document, TextSpan sourceSpan, ISymbol symbol, ushort glyphIndex)
            : base(document, sourceSpan, glyphIndex)
        {
            _symbolDisplay = symbol.ToDisplayString(definitionDisplayFormat);

            this.DisplayText = $"[{document.Project.Name}] {_symbolDisplay}";
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:7,代码来源:SourceDefinitionTreeItem.cs


示例2: ShouldOmitThisDiagnostic

        private static bool ShouldOmitThisDiagnostic(ISymbol symbol, Compilation compilation)
        {
            // This diagnostic is only relevant in constructors.
            // TODO: should this apply to instance field initializers for VB?
            var m = symbol as IMethodSymbol;
            if (m == null || m.MethodKind != MethodKind.Constructor)
            {
                return true;
            }

            var containingType = m.ContainingType;
            if (containingType == null)
            {
                return true;
            }

            // special case ASP.NET and WinForms constructors
            INamedTypeSymbol webUiControlType = compilation.GetTypeByMetadataName("System.Web.UI.Control");
            if (containingType.Inherits(webUiControlType))
            {
                return true;
            }

            INamedTypeSymbol windowsFormsControlType = compilation.GetTypeByMetadataName("System.Windows.Forms.Control");
            if (containingType.Inherits(windowsFormsControlType))
            {
                return true;
            }

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


示例3: AnalyzeCodeBlock

 public void AnalyzeCodeBlock(SyntaxNode codeBlock, ISymbol ownerSymbol, SemanticModel semanticModel, Action<Diagnostic> addDiagnostic, AnalyzerOptions options, CancellationToken cancellationToken)
 {
     if (IsEmptyFinalizer(codeBlock, semanticModel))
     {
         addDiagnostic(ownerSymbol.CreateDiagnostic(Rule));
     }
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:7,代码来源:CA1821DiagnosticAnalyzer.cs


示例4: DefaultVisit

 public override void DefaultVisit(ISymbol symbol, MetadataItem item, SymbolVisitorAdapter adapter)
 {
     foreach (var generator in _generators)
     {
         generator.DefaultVisit(symbol, item, adapter);
     }
 }
开发者ID:yonglehou,项目名称:docfx,代码行数:7,代码来源:CompositeYamlModelGenerator.cs


示例5: GenerateSyntax

 internal override void GenerateSyntax(MemberType type, ISymbol symbol, SyntaxDetail syntax, SymbolVisitorAdapter adapter)
 {
     foreach (var generator in _generators)
     {
         generator.GenerateSyntax(type, symbol, syntax, adapter);
     }
 }
开发者ID:yonglehou,项目名称:docfx,代码行数:7,代码来源:CompositeYamlModelGenerator.cs


示例6: Create

 public static CompletionItem Create(
     string displayText,
     TextSpan span,
     ISymbol symbol,
     int contextPosition = -1,
     int descriptionPosition = -1,
     string sortText = null,
     string insertionText = null,
     Glyph? glyph = null,
     string filterText = null,
     bool preselect = false,
     SupportedPlatformData supportedPlatforms = null,
     bool isArgumentName = false,
     ImmutableDictionary<string, string> properties = null,
     CompletionItemRules rules = null)
 {
     return Create(
         displayText: displayText,
         span: span,
         symbols: ImmutableArray.Create(symbol),
         contextPosition: contextPosition,
         descriptionPosition: descriptionPosition,
         sortText: sortText,
         insertionText: insertionText,
         glyph: glyph,
         filterText: filterText,
         preselect: preselect,
         supportedPlatforms: supportedPlatforms,
         isArgumentName: isArgumentName,
         properties: properties,
         rules: rules);
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:32,代码来源:SymbolCompletionItem.cs


示例7: RunRename

 public static void RunRename(ISymbol symbol, string newName = null)
 {
     if ((symbol is IMember) && ((symbol.SymbolKind == SymbolKind.Constructor) || (symbol.SymbolKind == SymbolKind.Destructor))) {
         // Don't rename constructors/destructors, rename their declaring type instead
         symbol = ((IMember) symbol).DeclaringType.GetDefinition();
     }
     if (symbol != null) {
         var project = GetProjectFromSymbol(symbol);
         if (project != null) {
             var languageBinding = project.LanguageBinding;
             if (newName == null) {
                 RenameSymbolDialog renameDialog = new RenameSymbolDialog(name => CheckName(name, languageBinding))
                 {
                     Owner = SD.Workbench.MainWindow,
                     OldSymbolName = symbol.Name,
                     NewSymbolName = symbol.Name
                 };
                 if (renameDialog.ShowDialog() == true) {
                     newName = renameDialog.NewSymbolName;
                 } else {
                     return;
                 }
             }
             AsynchronousWaitDialog.ShowWaitDialogForAsyncOperation(
                 "${res:SharpDevelop.Refactoring.Rename}",
                 progressMonitor =>
                 FindReferenceService.RenameSymbol(symbol, newName, progressMonitor)
                 .ObserveOnUIThread()
                 .Subscribe(error => SD.MessageService.ShowError(error.Message), ex => SD.MessageService.ShowException(ex), () => {}));
         }
     }
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:32,代码来源:FindReferencesCommand.cs


示例8: RenameSymbolAsync

        public static async Task<Solution> RenameSymbolAsync(Solution solution, ISymbol symbol, string newName, OptionSet optionSet, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (solution == null)
            {
                throw new ArgumentNullException(nameof(solution));
            }

            if (symbol == null)
            {
                throw new ArgumentNullException(nameof(symbol));
            }

            if (string.IsNullOrEmpty(newName))
            {
                throw new ArgumentException("newName");
            }

            cancellationToken.ThrowIfCancellationRequested();

            optionSet = optionSet ?? solution.Workspace.Options;
            var renameLocationSet = await RenameLocationSet.FindAsync(symbol, solution, optionSet, cancellationToken).ConfigureAwait(false);
            var conflictResolution = await ConflictEngine.ConflictResolver.ResolveConflictsAsync(renameLocationSet, symbol.Name, newName, optionSet, cancellationToken).ConfigureAwait(false);

            return conflictResolution.NewSolution;
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:25,代码来源:Renamer.cs


示例9: 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="cancellationToken">A cancellation token.</param>
 public static Task<IEnumerable<ReferencedSymbol>> FindReferencesAsync(
     ISymbol symbol,
     Solution solution,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return FindReferencesAsync(symbol, solution, progress: null, documents: null, cancellationToken: cancellationToken);
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:13,代码来源:SymbolFinder_References.cs


示例10: GetSymbolDepth

        private int GetSymbolDepth(ISymbol symbol)
        {
            ISymbol current = symbol.ContainingSymbol;
            int depth = 0;
            while (current != null)
            {
                var namespaceSymbol = current as INamespaceSymbol;
                if (namespaceSymbol != null)
                {
                    // if we've reached the global namespace, we're already at the top; bail
                    if (namespaceSymbol.IsGlobalNamespace)
                    {
                        break;
                    }
                }
                else
                {
                    // we don't want namespaces to add to our "depth" because they won't be displayed in the tree
                    depth++;
                }

                current = current.ContainingSymbol;
            }

            return depth;
        }
开发者ID:rgmills,项目名称:SourceBrowser,代码行数:26,代码来源:DocumentGenerator.Declarations.cs


示例11: MakeSnippetedResponses

        private IEnumerable<AutoCompleteResponse> MakeSnippetedResponses(AutoCompleteRequest request, ISymbol symbol)
        {
            var completions = new List<AutoCompleteResponse>();
            var methodSymbol = symbol as IMethodSymbol;
            if (methodSymbol != null)
            {
                if (methodSymbol.Parameters.Any(p => p.IsOptional))
                {
                    completions.Add(MakeAutoCompleteResponse(request, symbol, false));
                }
                completions.Add(MakeAutoCompleteResponse(request, symbol));
                return completions;
            }
            var typeSymbol = symbol as INamedTypeSymbol;
            if (typeSymbol != null)
            {
                completions.Add(MakeAutoCompleteResponse(request, symbol));

                if (typeSymbol.TypeKind != TypeKind.Enum)
                {
                    foreach (var ctor in typeSymbol.InstanceConstructors)
                    {
                        completions.Add(MakeAutoCompleteResponse(request, ctor));
                    }
                }
                return completions;
            }
            return new[] { MakeAutoCompleteResponse(request, symbol) };
        }
开发者ID:tugberkugurlu,项目名称:omnisharp-roslyn,代码行数:29,代码来源:OmnisharpController.Intellisense.cs


示例12: GenerateHyperlinkToReferences

        public HtmlElementInfo GenerateHyperlinkToReferences(ISymbol symbol, bool isLargeFile = false)
        {
            string symbolId = SymbolIdService.GetId(symbol);

            string referencesFilePath = Path.Combine(ProjectDestinationFolder, Constants.ReferencesFileName, symbolId + ".html");
            string href = Paths.MakeRelativeToFile(referencesFilePath, documentDestinationFilePath);
            href = href.Replace('\\', '/');

            var result = new HtmlElementInfo
            {
                Name = "a",
                Attributes =
                {
                    { "id", symbolId },
                    { "href", href },
                    { "target", "n" },
                },
                DeclaredSymbol = symbol,
                DeclaredSymbolId = symbolId
            };

            if (!isLargeFile)
            {
                var dataGlyph = string.Format("{0},{1}",
                    SymbolIdService.GetGlyphNumber(symbol),
                    GetSymbolDepth(symbol));
                result.Attributes.Add("data-glyph", dataGlyph);
            }

            return result;
        }
开发者ID:rgmills,项目名称:SourceBrowser,代码行数:31,代码来源:DocumentGenerator.Declarations.cs


示例13: RenameLocations

 internal RenameLocations(ISet<RenameLocation> locations, ISymbol symbol, Solution solution, IEnumerable<ISymbol> referencedSymbols, IEnumerable<ReferenceLocation> implicitLocations, OptionSet options)
 {
     _symbol = symbol;
     _solution = solution;
     _mergedResult = new SearchResult(locations, implicitLocations, referencedSymbols);
     Options = options;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:RenameLocations.cs


示例14: ParseDocumentation

        public SDLanguageItemCollection<SDDocumentation> ParseDocumentation(ISymbol symbol)
        {
            var documentationXml = symbol.GetDocumentationCommentXml();
            var docDic = new SDLanguageItemCollection<SDDocumentation>();
            if (!string.IsNullOrEmpty(documentationXml))
            {
                var xml = XDocument.Parse($"<doc>{documentationXml}</doc>");
                foreach (var child in xml.Descendants())
                {
                    var isoCode = child.Name.LocalName.ToLower();
                    if (CultureInfo.GetCultures(CultureTypes.NeutralCultures).Any(c => c.TwoLetterISOLanguageName == isoCode) || isoCode == "default")
                    {
                        // TODO
                        //_sdRepository.AddDocumentationLanguage(child.Name.ToLower());
                        var languageDoc = ParseDocumentation(child.Descendants(), true);
                        if(!docDic.ContainsKey(isoCode)) docDic.Add(isoCode, languageDoc);
                    }
                }

                //Es wurde keine Sprachunterstützung in der Doku genutzt.
                //Deswegen wird die Doku einfach als "default" geladen.
                if (docDic.Count == 0)
                {
                    var defaultDoc = ParseDocumentation(xml.Descendants());
                    docDic.Add("default", defaultDoc);
                }
            }
            return docDic;
        }
开发者ID:Geaz,项目名称:sharpDox,代码行数:29,代码来源:DocumentationParser.cs


示例15: CreatePartialCompletionData

		public CreatePartialCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, int declarationBegin, ITypeSymbol currentType, ISymbol member, bool afterKeyword) : base (keyHandler, factory, member)
		{
			this.afterKeyword = afterKeyword;
			this.currentType = currentType;
			this.declarationBegin = declarationBegin;
			this.GenerateBody = true;
		}
开发者ID:swarkcn,项目名称:monodevelop,代码行数:7,代码来源:CreatePartialCompletionData.cs


示例16: GetProjectFromSymbol

		ICSharpCode.SharpDevelop.Project.IProject GetProjectFromSymbol(ISymbol symbol)
		{
			switch (symbol.SymbolKind) {
				case SymbolKind.None:
					return null;
				case SymbolKind.TypeDefinition:
				case SymbolKind.Field:
				case SymbolKind.Property:
				case SymbolKind.Indexer:
				case SymbolKind.Event:
				case SymbolKind.Method:
				case SymbolKind.Operator:
				case SymbolKind.Constructor:
				case SymbolKind.Destructor:
				case SymbolKind.Accessor:
					return ((IEntity)symbol).ParentAssembly.GetProject();
				case SymbolKind.Namespace:
					return null; // TODO : extend rename on namespaces
				case SymbolKind.Variable:
					return SD.ProjectService.FindProjectContainingFile(new FileName(((IVariable)symbol).Region.FileName));
				case SymbolKind.Parameter:
					if (((IParameter) symbol).Owner != null) {
						return ((IParameter)symbol).Owner.ParentAssembly.GetProject();
					} else {
						return SD.ProjectService.FindProjectContainingFile(new FileName(((IParameter)symbol).Region.FileName));
					}
				case SymbolKind.TypeParameter:
					return null; // TODO : extend rename on type parameters
				default:
					throw new ArgumentOutOfRangeException();
			}
		}
开发者ID:dgrunwald,项目名称:SharpDevelop,代码行数:32,代码来源:FindReferencesCommand.cs


示例17: IsDiagnosticSuppressed

        private bool IsDiagnosticSuppressed(string id, ISymbol symbol)
        {
            Debug.Assert(id != null);
            Debug.Assert(symbol != null);

            if (symbol.Kind == SymbolKind.Namespace)
            {
                // Suppressions associated with namespace symbols only apply to namespace declarations themselves
                // and any syntax nodes immediately contained therein, not to nodes attached to any other symbols.
                // Diagnostics those nodes will be filtered by location, not by associated symbol.
                return false;
            }

            if (symbol.Kind == SymbolKind.Method)
            {
                var associated = ((IMethodSymbol)symbol).AssociatedSymbol;
                if (associated != null &&
                    (IsDiagnosticLocallySuppressed(id, associated) || IsDiagnosticGloballySuppressed(id, associated)))
                {
                    return true;
                }
            }

            if (IsDiagnosticLocallySuppressed(id, symbol) || IsDiagnosticGloballySuppressed(id, symbol))
            {
                return true;
            }

            // Check for suppression on parent symbol
            var parent = symbol.ContainingSymbol;
            return parent != null ? IsDiagnosticSuppressed(id, parent) : false;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:32,代码来源:SuppressMessageAttributeState.cs


示例18: MetadataNamedArgument

 public MetadataNamedArgument(ISymbol entity, Cci.ITypeReference type, Cci.IMetadataExpression value)
 {
     // entity must be one of INamedEntity or IFieldDefinition or IPropertyDefinition
     this.entity = entity;
     this.type = type;
     this.value = value;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:7,代码来源:MetadataNamedArgument.cs


示例19: HasAnnotationForSymbol

        public bool HasAnnotationForSymbol(ISymbol symbol, bool appliesToItem)
        {
            Guard.NotNull(symbol, "symbol");

            return HasAnnotationInGlobalCache(symbol, appliesToItem) ||
                HasAnnotationInSideBySideFile(symbol, appliesToItem);
        }
开发者ID:bkoelman,项目名称:ResharperCodeContractNullabilityFxCop,代码行数:7,代码来源:CachingExternalAnnotationsResolver.cs


示例20: SetBreakpointNameCmd

        /// <summary>
        /// Constructs a new break command
        /// </summary>
        /// <param name="breakSymbol">Symbol to break at</param>
        public SetBreakpointNameCmd(ISymbol breakSymbol, SetBreakpointRH.SetBreakpointDelegate rhCb, GDBSubProcess gdbProc)
            : base(gdbProc)
        {
            _breakSymbol = breakSymbol;

            _rh = new SetBreakpointRH(rhCb, _gdbProc);
        }
开发者ID:areiter,项目名称:InMemoryFuzzing,代码行数:11,代码来源:SetBreakpointNameCmd.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISymbolDocument类代码示例发布时间:2022-05-24
下一篇:
C# ISymUnmanagedVariable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap