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


C# NamespaceSymbol.GetMembers方法代码示例

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


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

示例1: LoadChildNamespace2

        private XElement LoadChildNamespace2(NamespaceSymbol n)
        {
            XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name));

            var children = n.GetMembers();
            n = null;

            var types = new List<NamedTypeSymbol>();
            var namespaces = new List<NamespaceSymbol>();

            foreach (var c in children)
            {
                NamedTypeSymbol t = c as NamedTypeSymbol;

                if (t != null)
                {
                    types.Add(t);
                }
                else
                {
                    namespaces.Add(((NamespaceSymbol)c));
                }
            }

            var childrenTypes = types.OrderBy(t => t, new NameAndArityComparer());

            elem.Add(from t in childrenTypes select LoadChildType(t));

            var childrenNS = namespaces.OrderBy((child) => child.Name, StringComparer.OrdinalIgnoreCase);

            elem.Add(from c in childrenNS select LoadChildNamespace2(c));

            return elem;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:34,代码来源:LoadingNamespacesAndTypes.cs

示例2: VisitNamespace

        public override void VisitNamespace(NamespaceSymbol symbol)
        {
            _cancellationToken.ThrowIfCancellationRequested();

            foreach (var s in symbol.GetMembers())
            {
                s.Accept(this);
            }
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:9,代码来源:SynthesizedMetadataCompiler.cs

示例3: LoadChildNamespace

        internal static XElement LoadChildNamespace(NamespaceSymbol n)
        {
            XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name));

            var childrenTypes = n.GetTypeMembers().OrderBy((t) => t, new NameAndArityComparer());

            elem.Add(from t in childrenTypes select LoadChildType(t));

            var childrenNS = n.GetMembers().
                                OfType<NamespaceSymbol>().
                                OrderBy(child => child.Name, StringComparer.OrdinalIgnoreCase);

            elem.Add(from c in childrenNS select LoadChildNamespace(c));

            return elem;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:16,代码来源:EmitMetadataTestBase.cs

示例4: VisitNamespace

        /// <summary>
        /// Write header, descend into members, and write footer.
        /// </summary>
        public override void VisitNamespace(NamespaceSymbol symbol)
        {
            _cancellationToken.ThrowIfCancellationRequested();

            if (symbol.IsGlobalNamespace)
            {
                Debug.Assert(_assemblyName != null);

                WriteLine("<?xml version=\"1.0\"?>");
                WriteLine("<doc>");
                Indent();

                if (!_compilation.Options.OutputKind.IsNetModule())
                {
                    WriteLine("<assembly>");
                    Indent();
                    WriteLine("<name>{0}</name>", _assemblyName);
                    Unindent();
                    WriteLine("</assembly>");
                }

                WriteLine("<members>");
                Indent();
            }

            Debug.Assert(!_isForSingleSymbol);
            foreach (var s in symbol.GetMembers())
            {
                _cancellationToken.ThrowIfCancellationRequested();
                s.Accept(this);
            }

            if (symbol.IsGlobalNamespace)
            {
                Unindent();
                WriteLine("</members>");
                Unindent();
                WriteLine("</doc>");
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:43,代码来源:DocumentationCommentCompiler.cs

示例5: GetAllNamespaceNames

 private static void GetAllNamespaceNames(ArrayBuilder<string> builder, NamespaceSymbol @namespace)
 {
     builder.Add(@namespace.ToTestDisplayString());
     foreach (var member in @namespace.GetMembers())
     {
         if (member.Kind != SymbolKind.Namespace)
         {
             continue;
         }
         GetAllNamespaceNames(builder, (NamespaceSymbol)member);
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:12,代码来源:MetadataTypeTests.cs


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