本文整理汇总了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;
}
示例2: VisitNamespace
public override void VisitNamespace(NamespaceSymbol symbol)
{
_cancellationToken.ThrowIfCancellationRequested();
foreach (var s in symbol.GetMembers())
{
s.Accept(this);
}
}
示例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;
}
示例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>");
}
}
示例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);
}
}