lundi 22 avril 2019

What is the output type from reflection in this code

I have the following method:

public static class ReflectionHelper
{
    public static List<?> FindType<T>()
    {
        var A =
            from Assemblies in AppDomain.CurrentDomain.GetAssemblies().AsParallel()
            from Types in Assemblies.GetTypes()
            let Attributes = Types.GetCustomAttributes(typeof(T), true)
            where Attributes?.Length > 0
            select new { Type = Types };

        var L = A.ToList();

        return L;
    }
}

what is the type of the list?

if I do:

foreach (var l in L) { ... }

it works find and I can go through the types, but dev environment I'm using (Rider) will not provide a type.





Aucun commentaire:

Enregistrer un commentaire