Ejemplo n.º 1
0
        private static ImmutableArray <Symbol> GetMembers(
            NamespaceOrTypeSymbol container,
            string qualifiedName,
            out NamespaceOrTypeSymbol lastContainer
            )
        {
            var parts = SplitMemberName(qualifiedName);

            lastContainer = container;
            for (int i = 0; i < parts.Length - 1; i++)
            {
                var nestedContainer = (NamespaceOrTypeSymbol)lastContainer.GetMember(parts[i]);
                if (nestedContainer == null)
                {
                    // If there wasn't a nested namespace or type with that name, assume it's a
                    // member name that includes dots (e.g. explicit interface implementation).
                    return(lastContainer.GetMembers(string.Join(".", parts.Skip(i))));
                }
                else
                {
                    lastContainer = nestedContainer;
                }
            }

            return(lastContainer.GetMembers(parts[parts.Length - 1]));
        }
Ejemplo n.º 2
0
        private static ImmutableArray <Symbol> GetMembers(NamespaceSymbol @namespace, string name)
        {
            var parts = SplitMemberName(name);
            NamespaceOrTypeSymbol symbol = @namespace;

            for (int i = 0; i < parts.Length - 1; i++)
            {
                symbol = (NamespaceOrTypeSymbol)symbol.GetMember(parts[i]);
            }
            return(symbol.GetMembers(parts[parts.Length - 1]));
        }
Ejemplo n.º 3
0
 public static T GetMember <T>(this NamespaceOrTypeSymbol symbol, string qualifiedName) where T : Symbol
 {
     return((T)symbol.GetMember(qualifiedName));
 }