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

C# INamespaceSymbol类代码示例

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

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



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

示例1: Create

            // The containing symbol can be one of many things. 
            // 1) Null when this is the global namespace for a compilation.  
            // 2) The SymbolId for an assembly symbol if this is the global namespace for an
            //    assembly.
            // 3) The SymbolId for a module symbol if this is the global namespace for a module.
            // 4) The SymbolId for the containing namespace symbol if this is not a global
            //    namespace.

            public static void Create(INamespaceSymbol symbol, SymbolKeyWriter visitor)
            {
                visitor.WriteString(symbol.MetadataName);

                if (symbol.ContainingNamespace != null)
                {
                    visitor.WriteBoolean(false);
                    visitor.WriteSymbolKey(symbol.ContainingNamespace);
                }
                else
                {
                    // A global namespace can either belong to a module or to a compilation.
                    Debug.Assert(symbol.IsGlobalNamespace);
                    switch (symbol.NamespaceKind)
                    {
                        case NamespaceKind.Module:
                            visitor.WriteBoolean(false);
                            visitor.WriteSymbolKey(symbol.ContainingModule);
                            break;
                        case NamespaceKind.Assembly:
                            visitor.WriteBoolean(false);
                            visitor.WriteSymbolKey(symbol.ContainingAssembly);
                            break;
                        case NamespaceKind.Compilation:
                            visitor.WriteBoolean(true);
                            visitor.WriteSymbolKey(null);
                            break;
                        default:
                            throw new NotImplementedException();
                    }
                }
            }
开发者ID:vslsnap,项目名称:roslyn,代码行数:40,代码来源:SymbolKey.NamespaceSymbolKey.cs


示例2: Map

    public IUnitNamespaceReference Map(INamespaceSymbol namespaceSymbol) {
      Contract.Requires(namespaceSymbol != null);
      Contract.Ensures(Contract.Result<IUnitNamespaceReference>() != null);
      IUnitNamespaceReference nsr = null;
      if (!namespaceSymbolCache.TryGetValue(namespaceSymbol, out nsr)) {

        if (namespaceSymbol.ContainingAssembly.Equals(this.assemblyBeingTranslated)) {
          var n = this.CreateNamespaceDefinition(namespaceSymbol);
          return n;
        }

        if (namespaceSymbol.IsGlobalNamespace) {
          var n = new Microsoft.Cci.MutableCodeModel.RootUnitNamespaceReference() {
            Unit = Map(namespaceSymbol.ContainingAssembly),
          };
          nsr = n;
        } else {
          var ns = new Microsoft.Cci.MutableCodeModel.NestedUnitNamespaceReference() {
            ContainingUnitNamespace = Map(namespaceSymbol.ContainingNamespace),
            Name = this.nameTable.GetNameFor(namespaceSymbol.Name),
          };
          nsr = ns;
        }
        namespaceSymbolCache[namespaceSymbol] = nsr;
      }
      Contract.Assume(nsr != null);
      return nsr;
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:28,代码来源:ReferenceMapper.cs


示例3: GetParsedNamespace

        private SDNamespace GetParsedNamespace(INamespaceSymbol namespaceSymbol)
        {
            var descriptionFiles = _descriptionFiles.Where(d => Path.GetFileName(d).ToLower().Contains(namespaceSymbol.Name.ToLower() + ".sdnd"));

            var descriptions = new SDLanguageItemCollection<SDTemplate>();
            foreach (var file in descriptionFiles)
            {
                if (!string.IsNullOrEmpty(namespaceSymbol.Name.Trim()))
                {
                    var splitted = Path.GetFileName(file).ToLower().Replace(namespaceSymbol.Name.ToLower(), " ").Split('.');
                    if (splitted.Length > 0 && splitted[0].Length == 2 && CultureInfo.GetCultures(CultureTypes.AllCultures).Any(c => c.TwoLetterISOLanguageName == splitted[0]))
                    {
                        descriptions.Add(splitted[0], new SDTemplate(File.ReadAllText(file), ParserOptions.Tokens));
                        ExecuteOnDocLanguageFound(splitted[0].ToLower());
                    }
                    else if (splitted.Length > 0 && string.IsNullOrEmpty(splitted[0].Trim()))
                    {
                        descriptions.Add("default", new SDTemplate(File.ReadAllText(file), ParserOptions.Tokens));
                    }
                }
            }

            return new SDNamespace(namespaceSymbol.GetIdentifier())
            {
                Assemblyname = namespaceSymbol.ContainingAssembly.Name,
                Descriptions = descriptions
            };
        }
开发者ID:Geaz,项目名称:sharpDox,代码行数:28,代码来源:NamespaceParser.cs


示例4: VisitNamespace

 public override void VisitNamespace(INamespaceSymbol symbol)
 {
     foreach (var member in symbol.GetMembers())
     {
         member.Accept(this);
     }
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:AbstractEntryPointFinder.cs


示例5: Attach

 public static void Attach(
     INamespaceSymbol @namespace,
     IList<ISymbol> imports)
 {
     var info = new CodeGenerationNamespaceInfo(imports ?? SpecializedCollections.EmptyList<ISymbol>());
     namespaceToInfoMap.Add(@namespace, info);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:7,代码来源:CodeGenerationNamespaceInfo.cs


示例6: VisitNamespace

 public override void VisitNamespace(INamespaceSymbol symbol)
 {
     ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
     {
         DisplayName = NameVisitorCreator.GetCSharp(NameOptions.None).GetName(symbol),
         DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified).GetName(symbol),
     });
 }
开发者ID:yonglehou,项目名称:docfx,代码行数:8,代码来源:ReferenceItemVisitor.cs


示例7: AddNamespaceOrTypeDeclarationAsync

		public static Task<Document> AddNamespaceOrTypeDeclarationAsync(Solution solution, INamespaceSymbol destination, INamespaceOrTypeSymbol namespaceOrType, CodeGenerationOptions options = default(CodeGenerationOptions), CancellationToken cancellationToken = default(CancellationToken))
		{
			try {
				return (Task<Document>)addNamespaceOrTypeDeclarationAsyncMethod.Invoke (null, new object[] { solution, destination, namespaceOrType, options != null ? options.Instance : null, cancellationToken });
			} catch (TargetInvocationException ex) {
				ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
				return null;
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:CodeGenerator.cs


示例8: Create

 internal static EnvDTE.CodeElements Create(
     CodeModelState state,
     object parent,
     ProjectId projectId,
     INamespaceSymbol namespaceSymbol)
 {
     var collection = new ExternalNamespaceCollection(state, parent, projectId, namespaceSymbol);
     return (EnvDTE.CodeElements)ComAggregate.CreateAggregatedObject(collection);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:9,代码来源:ExternalNamespaceCollection.cs


示例9: VisitNamespace

        public override void VisitNamespace(INamespaceSymbol symbol)
        {
            symbols.Add(symbol);

            foreach (var childSymbol in symbol.GetMembers())
            {
                childSymbol.Accept(this);
            }
        }
开发者ID:yumapos,项目名称:Yumapos-WCF-Generator,代码行数:9,代码来源:VirtualizationVisitor.cs


示例10: CreateForNamespace

 public IVsNavInfo CreateForNamespace(INamespaceSymbol namespaceSymbol, Project project, Compilation compilation, bool useExpandedHierarchy = false)
 {
     return Create(
         namespaceSymbol.ContainingAssembly,
         project,
         compilation,
         useExpandedHierarchy,
         namespaceName: GetNamespaceName(namespaceSymbol));
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:NavInfoFactory.cs


示例11: CollectTypes

        private static void CollectTypes(INamespaceSymbol ns, List<ITypeSymbol> types)
        {
            types.AddRange(ns.GetTypeMembers().Cast<ITypeSymbol>());

            foreach (var nestedNs in ns.GetNamespaceMembers())
            {
                CollectTypes(nestedNs, types);
            }
        }
开发者ID:leloulight,项目名称:Scaffolding,代码行数:9,代码来源:RoslynUtilities.cs


示例12: GetNameParts

        private static void GetNameParts(INamespaceSymbol namespaceSymbol, List<string> result)
        {
            if (namespaceSymbol == null || namespaceSymbol.IsGlobalNamespace)
            {
                return;
            }

            GetNameParts(namespaceSymbol.ContainingNamespace, result);
            result.Add(namespaceSymbol.Name);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:10,代码来源:INamespaceSymbolExtensions.cs


示例13: GetFullName

        /// <summary>
        /// Get the full name of a namespace. i.e. "OuterNamespace.Inner.ClassName"
        /// </summary>
        /// <param name="namespaceSymbol">namespace to get name of</param>
        /// <returns>Full display name for a namespaceSymbol</returns>
        internal static string GetFullName(INamespaceSymbol namespaceSymbol)
        {
            if (namespaceSymbol.ContainingNamespace != null &&
                !namespaceSymbol.ContainingNamespace.IsGlobalNamespace)
            {
                return GetFullName(namespaceSymbol.ContainingNamespace) + "." + namespaceSymbol.Name;
            }

            return namespaceSymbol.Name;
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-codeformatter-dotnet,代码行数:15,代码来源:NameHelper.cs


示例14: AddNamespaceLink

        protected void AddNamespaceLink(INamespaceSymbol namespaceSymbol)
        {
            if (namespaceSymbol.IsGlobalNamespace)
            {
                return;
            }

            var text = namespaceSymbol.ToDisplayString();
            var navInfo = _libraryManager.GetNamespaceNavInfo(namespaceSymbol, _project, GetCompilation(), useExpandedHierarchy: false);

            _description.AddDescriptionText3(text, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:12,代码来源:AbstractDescriptionBuilder.cs


示例15: Visit

		private void Visit(INamespaceSymbol nameSpace)
		{
			foreach (var type in nameSpace.GetTypeMembers())
			{
				Visit(type);
			}

			foreach (var innerNameSpace in nameSpace.GetNamespaceMembers())
			{
				Visit(innerNameSpace);
			}
		}
开发者ID:tumtumtum,项目名称:Shaolinq,代码行数:12,代码来源:CompilationLookup.cs


示例16: VisitNamespace

        public override void VisitNamespace(INamespaceSymbol symbol)
        {
            if (IsUnimportantSymbol(symbol))
                return;

            PrettyPrint(symbol);
            tabCount++;
            foreach(var childSymbol in symbol.GetMembers())
            {
                childSymbol.Accept(this);
            }
            tabCount--;
        }
开发者ID:JoshVarty,项目名称:RoslynPad,代码行数:13,代码来源:NamedTypeVisitor.cs


示例17: GenerateNamespaceDeclarationWorker

        private static SyntaxNode GenerateNamespaceDeclarationWorker(
            string name, INamespaceSymbol innermostNamespace)
        {
            var usings = GenerateUsingDirectives(innermostNamespace);

            // If they're just generating the empty namespace then make that into compilation unit.
            if (name == string.Empty)
            {
                return SyntaxFactory.CompilationUnit().WithUsings(usings);
            }

            return SyntaxFactory.NamespaceDeclaration(SyntaxFactory.ParseName(name)).WithUsings(usings);
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:13,代码来源:NamespaceGenerator.cs


示例18: GetIdForNamespaceAsync

        internal static async Task<GraphNodeId> GetIdForNamespaceAsync(INamespaceSymbol symbol, Solution solution, CancellationToken cancellationToken)
        {
            CodeQualifiedIdentifierBuilder builder = new CodeQualifiedIdentifierBuilder();

            var assembly = await GetAssemblyFullPathAsync(symbol, solution, cancellationToken).ConfigureAwait(false);
            if (assembly != null)
            {
                builder.Assembly = assembly;
            }

            builder.Namespace = symbol.ToDisplayString();

            return builder.ToQualifiedIdentifier();
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:14,代码来源:GraphNodeIdCreation.cs


示例19: CreateSDType

 private SDType CreateSDType(ITypeSymbol typeSymbol, INamespaceSymbol namespaceSymbol)
 {
     var sdNamespace = new SDNamespace(namespaceSymbol.GetIdentifier()) { IsProjectStranger = true };
     var sdType = new SDType(typeSymbol.GetIdentifier(), typeSymbol.Name, sdNamespace)
     {
         Accessibility = typeSymbol.DeclaredAccessibility.ToString().ToLower(),
         IsAbstract = typeSymbol.IsAbstract,
         IsReferenceType = typeSymbol.IsReferenceType,
         IsSealed = typeSymbol.IsSealed,
         IsStatic = typeSymbol.IsStatic,
         IsProjectStranger = true,
         Kind = typeSymbol.TypeKind.ToString().ToLower()
     };
     return sdType;
 }
开发者ID:Geaz,项目名称:sharpDox,代码行数:15,代码来源:StrangerTypeParser.cs


示例20: GetFullNamespace

        private static string GetFullNamespace(INamespaceSymbol namespaceSymbol)
        {
            string fullNamespace = namespaceSymbol.Name;

            if (!string.IsNullOrEmpty(fullNamespace))
            {
                string parentNamespace = CodeAnalysisHelper.GetFullNamespace(namespaceSymbol.ContainingNamespace);
                if (!string.IsNullOrEmpty(parentNamespace))
                {
                    fullNamespace = parentNamespace + Type.Delimiter + fullNamespace;
                }
            }

            return fullNamespace;
        }
开发者ID:MichaelSimons,项目名称:visual-studio-tools,代码行数:15,代码来源:CodeAnalysisHelper.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# INamingScope类代码示例发布时间:2022-05-24
下一篇:
C# INamespaceOrTypeSymbol类代码示例发布时间: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