I was recently tasked to refactor a WinForms application. Now familiar with ASP.NET MVC, I wondered how easy it would be to apply existing ASP.NET MVC constructs to WinForms. Implementing an IController is easy enough, but there’s still the matter of loose coupling within the IController’s execute method.
I’ve previously shown using reflection to allow loosely-coupled method invocation in ArcGIS Server Object Extensions, but reflection is wicked slow. I knew that people were writing ORM binding using IL op-codes, and I figured that Microsoft had done something similar for ASP.NET MVC.
It turns out that LINQ expressions can be compiled into IL op-codes and that people are doing it to invoke unknown code quickly, without reflection. No need to fire up Reflector to see Microsoft’s worth seeing LINQ implemenation, you can simply check CodePlex.