News for hackers. Stuff that matters.
Re:How the .NET Runtime Loads a Type by louthy on Friday June 16, 2017 @08:16AM (#14568228)
The signature of GetAllValidators must be: GetAllValidators<T>();

So it's whatever type of T you pass to GetAllValidators.

Re:How the .NET Runtime Loads a Type by GenericsMotors on Friday June 16, 2017 @09:52AM (#14568935)
Not to mention that in the original example IValidator is invariant...it can be far more flexible by making it covariant (IValidator<out T>) so that GetAllValidators can also be used on more derived types.

And then you can do for example:

    var validators = GetAllValidators<EntityBase>();
Where validators might be IEnumerable<IValidator<EntityBase>>. Compile-time type safety is preserved and each individual validator's generic type can be any type that is derived from EntityBase.

:)