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


C# INamespaceSymbol类代码示例

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


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


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