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


C# INamespaceSymbol.GetMembers方法代码示例

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


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

示例1: VisitNamespace

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

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

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

示例4: AddNamespace

        private void AddNamespace(INamespaceSymbol namespaceSymbol)
        {
            if (!_names.IsEmpty) return;

            var classList = namespaceSymbol.GetMembers();

            var methodsList = classList.ToList().SelectMany(x => x.GetMembers());

            var methods = new List<ISymbol>(methodsList);
            try
            {
                _names = new ConcurrentBag<ISymbol>(methods);
            }
            catch
            {
            }
        }
开发者ID:aviatrix,项目名称:YARA,代码行数:17,代码来源:DiagnosticAnalyzer.cs

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

示例6: GetRuleDependencyAttributeTypeSymbols

        private ImmutableArray<INamedTypeSymbol> GetRuleDependencyAttributeTypeSymbols(INamespaceSymbol globalNamespace)
        {
            var builder = ImmutableArray.CreateBuilder<INamedTypeSymbol>();
            foreach (var antlr4Namespace in globalNamespace.GetMembers("Antlr4").OfType<INamespaceSymbol>())
            {
                foreach (var runtimeNamespace in antlr4Namespace.GetMembers("Runtime").OfType<INamespaceSymbol>())
                {
                    builder.AddRange(runtimeNamespace.GetTypeMembers("RuleDependencyAttribute"));
                }
            }

            return builder.ToImmutable();
        }
开发者ID:modulexcite,项目名称:RuleDependencyAnalyzer,代码行数:13,代码来源:DiagnosticAnalyzer.cs

示例7: BindsWithoutErrors

        private bool BindsWithoutErrors(INamespaceSymbol ns, string rightName, bool isAttributeName)
        {
            // If there was no name on the right, then this binds without any problems.
            if (rightName == null)
            {
                return true;
            }

            // Otherwise, see if the namespace we will bind this contains a member with the same
            // name as the name on the right.
            var types = ns.GetMembers(rightName);
            if (types.Any())
            {
                return true;
            }

            if (!isAttributeName)
            {
                return false;
            }
            
            return BindsWithoutErrors(ns, rightName + "Attribute", isAttributeName: false);
        }
开发者ID:genlu,项目名称:roslyn,代码行数:23,代码来源:AbstractFullyQualifyCodeFixProvider.cs

示例8: VisitNamespace

 public override void VisitNamespace(INamespaceSymbol symbol)
 {
     foreach (var member in symbol.GetMembers()) { Visit(member); }
     base.VisitNamespace(symbol);
 }
开发者ID:blinds52,项目名称:binskim,代码行数:5,代码来源:RoslynSymbolVisitor.cs

示例9: TranslateMetadata

    private NestedUnitNamespace TranslateMetadata(INamespaceSymbol namespaceSymbol) {
      Contract.Requires(namespaceSymbol != null);
      Contract.Ensures(Contract.Result<UnitNamespace>() != null);

      IUnitNamespaceReference nsr;
      if (this.namespaceSymbolCache.TryGetValue(namespaceSymbol, out nsr)) {
        var alreadyTranslatedNamespace = nsr as IUnitNamespace;
        if (alreadyTranslatedNamespace != null) return alreadyTranslatedNamespace as NestedUnitNamespace;
      }

      var ns = CreateNamespaceDefinition(namespaceSymbol);

      var mems = new List<INamespaceMember>();
      foreach (var m in namespaceSymbol.GetMembers()) {

        var nestedNamespaceSymbol = m as INamespaceSymbol;
        if (nestedNamespaceSymbol != null) {
          var cciNtd = TranslateMetadata(nestedNamespaceSymbol);
          mems.Add(cciNtd);
        }

        var typeSymbol = m as INamedTypeSymbol;
        if (typeSymbol != null) {
          var cciType = (INamespaceTypeDefinition)TranslateMetadata(typeSymbol);
          mems.Add(cciType);
          continue;
        }

      }
      ns.Members = mems;
      return ns;
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:32,代码来源:ReferenceMapper.cs

示例10: MapGlobalTypes

        internal static void MapGlobalTypes(NamespaceInfoMap nsInfoMap, INamespaceSymbol nsSymbol)
        {
            if (!nsSymbol.IsGlobalNamespace)
            {
                foreach (var nsInfo in nsInfoMap.Values)
                {
                    if (nsSymbol.FullNameEquals(nsInfo.DottedName.NameParts))
                    {
                        var typeSymbolList = nsSymbol.GetMembers().OfType<INamedTypeSymbol>().Where(i => i.TypeKind == Microsoft.CodeAnalysis.TypeKind.Class).ToList();
                        for (var i = 0; i < typeSymbolList.Count;)
                        {
                            var typeSymbol = typeSymbolList[i];
                            var clsAttData = typeSymbol.GetAttributeData(SchemaClassAttributeNameParts);
                            if (clsAttData != null)
                            {
                                if (typeSymbol.IsGenericType)
                                {
                                    CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeGeneric), GetTextSpan(typeSymbol));
                                }
                                if (typeSymbol.IsStatic)
                                {
                                    CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeStatic), GetTextSpan(typeSymbol));
                                }
                                var clsName = GetFirstArgumentAsString(clsAttData);
                                if (clsName == null)
                                {
                                    CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaClassAttribute), GetTextSpan(clsAttData));
                                }
                                var clsInfo = nsInfo.TryGetGlobalType<ClassTypeInfo>(clsName);
                                if (clsInfo == null)
                                {
                                    CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.InvalidSchemaClassAttributeName, clsName), GetTextSpan(clsAttData));
                                }
                                if (clsInfo.Symbol != null)
                                {
                                    CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.DuplicateSchemaClassAttributeName, clsName), GetTextSpan(clsAttData));
                                }
                                if (!clsInfo.IsAbstract)
                                {
                                    if (typeSymbol.IsAbstract)
                                    {
                                        CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.NonAbstractSchemaClassRequired),
                                            GetTextSpan(typeSymbol));
                                    }
                                    if (!typeSymbol.HasParameterlessConstructor())
                                    {
                                        CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.ParameterlessConstructorRequired),
                                            GetTextSpan(typeSymbol));
                                    }
                                }
                                clsInfo.Symbol = typeSymbol;
                                typeSymbolList.RemoveAt(i);
                                continue;
                            }
                            ++i;
                        }

                        foreach (var typeSymbol in typeSymbolList)
                        {
                            if (!typeSymbol.IsGenericType)
                            {
                                var clsName = typeSymbol.Name;
                                var clsInfo = nsInfo.TryGetGlobalType<ClassTypeInfo>(clsName);
                                if (clsInfo != null)
                                {
                                    if (clsInfo.Symbol == null)
                                    {
                                        if (typeSymbol.IsStatic)
                                        {
                                            CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.SchemaClassCannotBeStatic), GetTextSpan(typeSymbol));
                                        }
                                        if (!clsInfo.IsAbstract)
                                        {
                                            if (typeSymbol.IsAbstract)
                                            {
                                                CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.NonAbstractSchemaClassRequired),
                                                    GetTextSpan(typeSymbol));
                                            }
                                            if (!typeSymbol.HasParameterlessConstructor())
                                            {
                                                CompilerContext.ErrorAndThrow(new DiagMsgEx(DiagCodeEx.ParameterlessConstructorRequired),
                                                    GetTextSpan(typeSymbol));
                                            }
                                        }
                                        clsInfo.Symbol = typeSymbol;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            foreach (var subNsSymbol in nsSymbol.GetNamespaceMembers())
            {
                MapGlobalTypes(nsInfoMap, subNsSymbol);
            }
        }
开发者ID:knat,项目名称:SData,代码行数:97,代码来源:CSEX.cs


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