Here are some resources;
Here is the recipe;
Here is another one (recipe is different);
The last one;
Here is a good discussion;
Using reflection, this is how we get all types that implement an interface with C# 3.0/.NET 3.5 with the least code, and minimizing iterations.
var type = typeof(IMyInterface); var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => type.IsAssignableFrom(p));
Basically, the least amount of iterations will always be:
loop assemblies loop types see if implemented.
When we are suppose to use different parentheses in C#. When I run into a situation where i am trying to tell if i need to put <> or ().
The dumbed down version to explain is this;
() are for variables. <> are for types. If you have both, <> always comes first.
You would never has A(int). It would be A<int>. You’d also never have B<5>. It would always be B(5). And, rule two, you might have C<int>(5), but never C(5)<int>.
<> are used in generics.