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


C# ISymbol.GetDocumentationCommentId方法代码示例

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


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

示例1: GetId

        public static string GetId(ISymbol symbol)
        {
            if (symbol == null)
            {
                return null;
            }

            var assemblySymbol = symbol as IAssemblySymbol;
            if (assemblySymbol != null)
            {
                return assemblySymbol.MetadataName;
            }
            var dynamicSymbol = symbol as IDynamicTypeSymbol;
            if (dynamicSymbol != null)
            {
                return typeof(object).FullName;
            }
            string str = symbol.GetDocumentationCommentId();
            if (string.IsNullOrEmpty(str))
            {
                return null;
            }

            return str.ToString().Substring(2);
        }
开发者ID:dotnet,项目名称:docfx,代码行数:25,代码来源:VisitorHelper.cs

示例2: GetCommentId

        public static string GetCommentId(ISymbol symbol)
        {
            if (symbol == null || symbol is IAssemblySymbol)
            {
                return null;
            }

            if (symbol is IDynamicTypeSymbol)
            {
                return "T:" + typeof(object).FullName;
            }
            return symbol.GetDocumentationCommentId();
        }
开发者ID:dotnet,项目名称:docfx,代码行数:13,代码来源:VisitorHelper.cs

示例3: GetDocumentationCommentId

        private static string GetDocumentationCommentId(ISymbol symbol)
        {
            string result = null;
            if (!symbol.IsDefinition) {
                symbol = symbol.OriginalDefinition;
            }

            result = symbol.GetDocumentationCommentId();

            result = result.Replace("#ctor", "ctor");

            return result;
        }
开发者ID:jerriclynsjohn,项目名称:Ref12,代码行数:13,代码来源:IndexIdTranslator.cs

示例4: GetDocumentation

		public static string GetDocumentation (ISymbol entity)
		{
			if (entity == null)
				throw new System.ArgumentNullException ("entity");
			
			// If we had an exception while getting the help xml the monodoc help provider
			// shouldn't try it again. A corrupt .zip file could cause long tooltip delays otherwise.
			if (hadError)
				return null;
			var idString = entity.GetDocumentationCommentId ();
			if (string.IsNullOrEmpty (idString))
				return null;
			string result;
			if (commentCache.TryGetValue (idString, out result))
				return result;
			XmlDocument doc = null;
			try {
				var helpTree = MonoDevelop.Projects.HelpService.HelpTree;
				if (helpTree == null)
					return null;
#pragma warning disable 618
				if (entity.Kind == SymbolKind.NamedType) {
				doc = helpTree.GetHelpXml (idString);
				} else {
					var containingType = entity.ContainingType;
					if (containingType == null)
						return null;
					var parentId = containingType.GetDocumentationCommentId ();
					doc = helpTree.GetHelpXml (parentId);
					if (doc == null)
						return null;
					XmlNode node = SelectNode (doc, entity);
					if (node != null)
						return commentCache [idString] = node.OuterXml;
					return null;
				}
			} catch (Exception e) {
				hadError = true;
				LoggingService.LogError ("Error while reading monodoc file.", e);
			}
			if (doc == null) {
				commentCache [idString] = null;
				return null;
			}
			return commentCache [idString] = doc.OuterXml;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:46,代码来源:MonoDocDocumentationProvider.cs

示例5: GetId

 private static string GetId(ISymbol symbol)
 {
     return BitConverter.ToString(BitConverter.GetBytes(Crc32.Calculate(symbol.GetDocumentationCommentId() ?? GetFullName(symbol)))).Replace("-", string.Empty);
 }
开发者ID:martinvobr,项目名称:Wyam,代码行数:4,代码来源:AnalyzeSymbolVisitor.cs

示例6: AddDocument

        private void AddDocument(ISymbol symbol, bool xmlDocumentation, MetadataItems items)
        {
            // Get universal metadata
            items.AddRange(new []
            {
                // In general, cache the values that need calculation and don't cache the ones that are just properties of ISymbol
                new MetadataItem(CodeAnalysisKeys.IsResult, !_finished),
                new MetadataItem(CodeAnalysisKeys.SymbolId, (k, m) => GetId(symbol), true),
                new MetadataItem(CodeAnalysisKeys.Symbol, symbol),
                new MetadataItem(CodeAnalysisKeys.Name, (k, m) => symbol.Name),
                new MetadataItem(CodeAnalysisKeys.FullName, (k, m) => GetFullName(symbol), true),
                new MetadataItem(CodeAnalysisKeys.DisplayName, (k, m) => GetDisplayName(symbol), true),
                new MetadataItem(CodeAnalysisKeys.QualifiedName, (k, m) => GetQualifiedName(symbol), true),
                new MetadataItem(CodeAnalysisKeys.Kind, (k, m) => symbol.Kind.ToString()),
                new MetadataItem(CodeAnalysisKeys.ContainingNamespace, DocumentFor(symbol.ContainingNamespace)),
                new MetadataItem(CodeAnalysisKeys.Syntax, (k, m) => GetSyntax(symbol), true)
            });

            // Add metadata that's specific to initially-processed symbols
            if (!_finished)
            {
                items.AddRange(new[]
                {
                    new MetadataItem(Keys.WritePath, (k, m) => _writePath(m), true),
                    new MetadataItem(Keys.RelativeFilePath, 
                        (k, m) => m.String(Keys.WritePath)),
                    new MetadataItem(Keys.RelativeFilePathBase, 
                        (k, m) => PathHelper.RemoveExtension(m.String(Keys.WritePath))),
                    new MetadataItem(Keys.RelativeFileDir, 
                        (k, m) => Path.GetDirectoryName(m.String(Keys.WritePath)))
                });
            }

            // XML Documentation
            if (xmlDocumentation && (!_finished || _docsForImplicitSymbols))
            {
                AddXmlDocumentation(symbol, items);
            }

            // Create the document and add it to the cache
            IDocument document = _context.GetNewDocument(symbol.ToDisplayString(), null, items);
            _symbolToDocument.GetOrAdd(symbol, _ => document);

            // Map the comment ID to the document
            if (!_finished)
            {
                string documentationCommentId = symbol.GetDocumentationCommentId();
                if (documentationCommentId != null)
                {
                    _commentIdToDocument.GetOrAdd(documentationCommentId, _ => document);
                }
            }
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:53,代码来源:AnalyzeSymbolVisitor.cs

示例7: AddDocument

        private void AddDocument(ISymbol symbol, bool xmlDocumentation, IEnumerable<KeyValuePair<string, object>> items)
        {
            // Get universal metadata
            List<KeyValuePair<string, object>> metadata = new List<KeyValuePair<string, object>>
            {
                // In general, cache the values that need calculation and don't cache the ones that are just properties of ISymbol
                Metadata.Create(MetadataKeys.IsResult, !_finished),
                Metadata.Create(MetadataKeys.SymbolId, (k, m) => GetId(symbol), true),
                Metadata.Create(MetadataKeys.Symbol, symbol),
                Metadata.Create(MetadataKeys.Name, (k, m) => symbol.Name),
                Metadata.Create(MetadataKeys.FullName, (k, m) => GetFullName(symbol), true),
                Metadata.Create(MetadataKeys.DisplayName, (k, m) => GetDisplayName(symbol), true),
                Metadata.Create(MetadataKeys.QualifiedName, (k, m) => GetQualifiedName(symbol), true),
                Metadata.Create(MetadataKeys.Kind, (k, m) => symbol.Kind.ToString()),
                Metadata.Create(MetadataKeys.ContainingNamespace, DocumentFor(symbol.ContainingNamespace))
            };

            // Add metadata that's specific to initially-processed symbols
            if (!_finished)
            {
                metadata.AddRange(new[]
                {
                    Metadata.Create(MetadataKeys.WritePath, (k, m) => _writePath(m), true),
                    Metadata.Create(MetadataKeys.Syntax, (k, m) => GetSyntax(symbol), true)
                });

                // XML Documentation
                if (xmlDocumentation)
                {
                    AddXmlDocumentation(symbol, metadata);
                }
            }

            // Create the document and add it to the cache
            IDocument document = _context.GetNewDocument(symbol.ToDisplayString(), null, items.Concat(metadata));
            _symbolToDocument.GetOrAdd(symbol, _ => document);

            // Map the comment ID to the document
            if (!_finished)
            {
                string documentationCommentId = symbol.GetDocumentationCommentId();
                if (documentationCommentId != null)
                {
                    _commentIdToDocument.GetOrAdd(documentationCommentId, _ => document);
                }
            }
        }
开发者ID:st1pps,项目名称:Wyam,代码行数:47,代码来源:AnalyzeSymbolVisitor.cs

示例8: GetDocId

        private string GetDocId(ISymbol symbol)
        {
            if (symbol == null)
            {
                return UnknownSymbolName;
            }

            if (symbol is INamedTypeSymbol)
            {
                var typeSymbol = (INamedTypeSymbol)symbol;
                if (typeSymbol.IsGenericType && typeSymbol.OriginalDefinition != null)
                {
                    return typeSymbol.OriginalDefinition.GetDocumentationCommentId();
                }
            }
            else if (symbol is IMethodSymbol)
            {
                var methodSymbol = (IMethodSymbol)symbol;
                if (methodSymbol.IsGenericMethod && methodSymbol.OriginalDefinition != null)
                {
                    return methodSymbol.OriginalDefinition.GetDocumentationCommentId();
                }
            }

            return symbol.GetDocumentationCommentId();
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:26,代码来源:CompilationErrorDetailDiscoverer.cs

示例9: RoslynJumpToDeclaration

		public static async Task RoslynJumpToDeclaration (ISymbol symbol, Projects.Project hintProject = null, CancellationToken token = default(CancellationToken))
		{
			var result = await TryJumpToDeclarationAsync (symbol.GetDocumentationCommentId (), hintProject, token).ConfigureAwait (false);
			if (!result) {
				await Runtime.RunInMainThread (delegate {
					IdeApp.ProjectOperations.JumpToDeclaration (symbol, hintProject);
				});
			}
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:9,代码来源:RefactoringService.cs

示例10: TryGetMember

        private static bool TryGetMember(ISymbol symbol, out AnnotationMember member)
        {
            var attributes = GetAttributes(symbol).ToImmutableArray();

            if (ShouldIncludeInResult(attributes))
            {
                var memberName = symbol.GetDocumentationCommentId();

                member = new AnnotationMember(memberName, attributes);
                return true;
            }

            member = null;
            return false;
        }
开发者ID:khellang,项目名称:JetBrains.Annotations.Dnx,代码行数:15,代码来源:AnnotationsCompileModule.cs

示例11: AddDocumentationId

 private void AddDocumentationId(AbstractSymbolNode node, ISymbol symbol)
 {
     string documentationId = symbol.GetDocumentationCommentId();
     documentationIds.Add(node.ToString(), documentationId);
     documentationIdsByProject.Add(documentationId, currentProject);
 }
开发者ID:jeremybeavon,项目名称:GitHistoryByMember,代码行数:6,代码来源:DocumentationIdBuilder.cs

示例12: RoslynJumpToDeclaration

		public static async Task RoslynJumpToDeclaration (ISymbol symbol, Projects.Project hintProject = null, CancellationToken token = default(CancellationToken))
		{
			if (symbol.Locations.Any (loc => loc.IsInSource)) { // all locals are in source.
				await Runtime.RunInMainThread (delegate {
					IdeApp.ProjectOperations.JumpToDeclaration (symbol, hintProject);
				});
				return;
			}
			var result = await TryJumpToDeclarationAsync (symbol.GetDocumentationCommentId (), hintProject, token).ConfigureAwait (false);
			if (!result) {
				await Runtime.RunInMainThread (delegate {
					IdeApp.ProjectOperations.JumpToDeclaration (symbol, hintProject);
				});
			}
		}
开发者ID:swarkcn,项目名称:monodevelop,代码行数:15,代码来源:RefactoringService.cs


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