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


C# INamespaceSymbol.GetTypeMembers方法代码示例

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


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

示例1: 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

示例2: 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

示例3: ParseProjectNamespacesRecursively

        internal void ParseProjectNamespacesRecursively(INamespaceSymbol namespaceSymbol)
        {
            HandleOnItemParseStart(namespaceSymbol.Name);
            if (!ParserOptions.SharpDoxConfig.ExcludedIdentifiers.Contains(namespaceSymbol.GetIdentifier()))
            {
                var sdNamespace = GetParsedNamespace(namespaceSymbol);
                ParserOptions.SDRepository.AddNamespace(sdNamespace);
                _typeParser.ParseProjectTypes(namespaceSymbol.GetTypeMembers().ToList());
            }

            foreach (var childNamespaceSymbol in namespaceSymbol.GetNamespaceMembers())
            {
                ParseProjectNamespacesRecursively(childNamespaceSymbol);
            }
        }
开发者ID:Geaz,项目名称:sharpDox,代码行数:15,代码来源:NamespaceParser.cs

示例4: VisitNamespace

        public override void VisitNamespace(INamespaceSymbol symbol)
        {
            if (_finished || _symbolPredicate == null || _symbolPredicate(symbol))
            {
                AddDocument(symbol, true, new MetadataItems
                {
                    { CodeAnalysisKeys.SpecificKind, (k, m) => symbol.Kind.ToString() },
                    { CodeAnalysisKeys.MemberNamespaces, DocumentsFor(symbol.GetNamespaceMembers()) },
                    { CodeAnalysisKeys.MemberTypes, DocumentsFor(symbol.GetTypeMembers()) }
                });
            }

            // Descend if not finished, regardless if this namespace was included
            if (!_finished)
            {
                Parallel.ForEach(symbol.GetMembers(), s => s.Accept(this));
            }
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:18,代码来源:AnalyzeSymbolVisitor.cs

示例5: GetAllTypesInModuleSymbol

 private static IEnumerable<ITypeSymbol> GetAllTypesInModuleSymbol(INamespaceSymbol symbol)
 {
     return Enumerable.Concat(symbol.GetTypeMembers(), symbol.GetNamespaceMembers().SelectMany(GetAllTypesInModuleSymbol));
 }
开发者ID:ElboNet,项目名称:dotvvm,代码行数:4,代码来源:CompletionHelper.cs

示例6: GetExportedTypes

        private static void GetExportedTypes(INamespaceSymbol namespaceSymbol, List<ITypeInfo> exportedTypes)
        {
            foreach (var type in namespaceSymbol.GetTypeMembers())
            {
                if (type.TypeKind == TypeKind.Class &&
                    type.DeclaredAccessibility == Accessibility.Public)
                {
                    exportedTypes.Add(new CodeAnalysisSymbolBasedTypeInfo(type));
                }
            }

            foreach (var subNamespace in namespaceSymbol.GetNamespaceMembers())
            {
                GetExportedTypes(subNamespace, exportedTypes);
            }
        }
开发者ID:huoxudong125,项目名称:Razor,代码行数:16,代码来源:PrecompilationTagHelperTypeResolver.cs

示例7: FillNamespaces

		public static void FillNamespaces (ITreeBuilder builder, Project project, INamespaceSymbol ns)
		{
			var members = ns.GetTypeMembers ();
			//IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project);
			if (members.Any ()) {
				if (builder.Options ["ShowProjects"])
					builder.AddChild (new ProjectNamespaceData (project, ns));
				else {
					if (!builder.HasChild (ns.Name, typeof (NamespaceData)))
						builder.AddChild (new ProjectNamespaceData (null, ns));
				}
			}
			foreach (var nSpace in ns.GetNamespaceMembers ()) {
				FillNamespaces (builder, project, nSpace);
			}
		}
开发者ID:xinfushe,项目名称:monodevelop,代码行数:16,代码来源:ProjectNodeBuilder.cs

示例8: VisitNamespace

 public override void VisitNamespace(INamespaceSymbol symbol)
 {
     base.VisitNamespace(symbol);
     foreach (var item in symbol.GetTypeMembers())
     {
         item.Accept(this);
     }
     foreach (var item in symbol.GetNamespaceMembers())
     {
         item.Accept(this);
     }
 }
开发者ID:x335,项目名称:WootzJs,代码行数:12,代码来源:SymbolWalker.cs

示例9: ProcessNamespace

        /// <summary>
        /// Reqursively goes through all namespaces in the assembly and discovers unique types, extensions and namespaces.
        /// </summary>
        private void ProcessNamespace(AssemblyMetadata assembly, INamespaceSymbol namespaceSymbol)
        {
            var assemblyName = Path.GetFileName(assembly.FullPath);
            if (string.IsNullOrEmpty(assemblyName) || namespaceSymbol == null)
            {
                return;
            }

            var fullNamespaceName = (namespaceSymbol.ContainingNamespace == null || string.IsNullOrEmpty(namespaceSymbol.ContainingNamespace.Name))
                    ? namespaceSymbol.Name
                    : namespaceSymbol.ContainingNamespace + "." + namespaceSymbol.Name;

            foreach (var typeName in namespaceSymbol.GetTypeMembers())
            {
                try
                {
                    // keep only public types
                    if (typeName.DeclaredAccessibility != Accessibility.Public)
                    {
                        continue;
                    }

                    var typeFullName = string.IsNullOrEmpty(fullNamespaceName)
                                        ? typeName.Name
                                        : typeName.ContainingNamespace + "." + typeName.Name;

                    // if we meet this type first time - remember it
                    if (!_types.ContainsKey(typeFullName))
                    {
                        var newType = new TypeModel
                        {
                            Name = typeName.Name,
                            FullName = typeFullName,
                            AssemblyName = assemblyName,
                            PackageName = _package.Id,
                            PackageVersion = _package.Version
                        };
                        newType.TargetFrameworks.AddRange(assembly.TargetFrameworks);

                        _types.Add(typeFullName, newType);

                        // if namespace contains at least one type and we meet this namespace first time - remember it
                        if (!string.IsNullOrEmpty(fullNamespaceName) && !_namespaces.ContainsKey(fullNamespaceName))
                        {
                            var newNamespace = new NamespaceModel
                            {
                                Name = fullNamespaceName,
                                AssemblyName = assemblyName,
                                PackageName = _package.Id,
                                PackageVersion = _package.Version
                            };
                            newNamespace.TargetFrameworks.AddRange(assembly.TargetFrameworks);

                            _namespaces.Add(fullNamespaceName, newNamespace);
                        }
                        else
                        {
                            var namespaceModel = _namespaces[fullNamespaceName];
                            namespaceModel.MergeTargetFrameworks(assembly.TargetFrameworks);
                        }
                    }
                    else
                    {
                        var typeModel = _types[typeFullName];
                        typeModel.MergeTargetFrameworks(assembly.TargetFrameworks);

                        if (!string.IsNullOrEmpty(fullNamespaceName))
                        {
                            var namespaceModel = _namespaces[fullNamespaceName];
                            namespaceModel.MergeTargetFrameworks(assembly.TargetFrameworks);
                        }
                    }

                    // if type is static, then it might contain extension methdos 
                    if (typeName.IsStatic)
                    {
                        foreach (var member in typeName.GetMembers())
                        {
                            // proceed only if static type's member is a method and it is public
                            var method = member as IMethodSymbol;
                            if (method == null || method.DeclaredAccessibility != Accessibility.Public)
                            {
                                continue;
                            }

                            if (method.IsExtensionMethod)
                            {
                                var thisParameter = method.Parameters[0];
                                var extensionMethodTypeName = thisParameter.Type.ContainingNamespace + "." + thisParameter.Type.Name;
                                var extensionFullName = extensionMethodTypeName + "." + method.Name;

                                // if we meet this extension first time - remember it
                                if (!_extensions.ContainsKey(extensionFullName))
                                {
                                    var newExtension = new ExtensionModel
                                    {
                                        Name = method.Name,
//.........这里部分代码省略.........
开发者ID:digideskio,项目名称:NuGet.PackageIndex,代码行数:101,代码来源:RoslynReflector.cs

示例10: EnumSymbols

        private static void EnumSymbols(INamespaceSymbol namespaceSymbol, Action<ISymbol> action)
        {
            foreach (var subNamespace in namespaceSymbol.GetNamespaceMembers())
            {
                EnumSymbols(subNamespace, action);
            }

            foreach (var topLevelType in namespaceSymbol.GetTypeMembers())
            {
                action(topLevelType);
            }
        }
开发者ID:KirillOsenkov,项目名称:SourceBrowser,代码行数:12,代码来源:MetadataAsSource.cs

示例11: ScanNamespace

 private static void ScanNamespace(IList<Diagnostic> diagnostics, INamespaceSymbol namespaceSymbol)
 {
     foreach (var member in namespaceSymbol.GetNamespaceMembers())
     {
         ScanNamespace(diagnostics, member);
     }
     foreach (var member in namespaceSymbol.GetTypeMembers())
     {
         ScanType(diagnostics, member);
     }
 }
开发者ID:leloulight,项目名称:KestrelHttpServer,代码行数:11,代码来源:StandardsPoliceCompileModule.cs


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