3 ms·
I think he may mean that a lot of reflection methods take Type rather than a generic parameter? A lot of those have generic overloads now though.
by eropple 10y ago
I think he may mean that a lot of reflection methods take Type rather than a generic parameter? A lot of those have generic overloads now though.
- naasking 10y agoWhat would really make reflection fast is the dual operation of typeof(T) -> Type, that is, Type -> T. Then you can do all kinds of neat but efficient things by exploiting the CLR's runtime generics [1]. This is something that would be easily done in the CLR itself, a sort of hidden universal method that could perform a single, maybe double, dispatch into the correct generic overload, but alas, we are left only to simulate this using poor imitations of inline caches. [1] https://github.com/naasking/Dynamics.NET https://github.com/naasking/Dynamics.NET
- matthewwarren 10y agoCool, Dynamics.NET look like a cool library, I'd not heard of it before, thanks
- __s 10y agoThat is what I meant. I may be a bit outdated with C# versions, still working with 4.5