Exemplo n.º 1
0
        public static IEnumerable <INamedTypeSymbol> Types(this INamespaceOrTypeSymbol symbol, Type type)
        {
            var current = new INamespaceOrTypeSymbol[] { symbol };

            foreach (var segment in type.Path())
            {
                current = current.SelectMany(child => child.GetMembers(segment)).OfType <INamespaceOrTypeSymbol>().ToArray();
            }
            return(current.OfType <INamedTypeSymbol>().Where(child => child.IsGenericType == type.IsConstructedGenericType));
        }