This blog post is a strange one in a lot of ways, it is more of me pointing out a set of recipes and linking through to a related article. So what are the recipes, and what will it show you, the reader how to do?
Well I am going to start with a wee story first (don’t worry the point is one its way). A while back I got this email out the blue from this guy in the states who was creating a MVVM framework for Windows 8, and I have kept in contact with this dude (and he really is a dude, if I can convince him to upload an image, you will see what I mean) and we got talking about his IOC container within his MVVM framework, which is like MEF for Windows 8.
Looking through Ian’s code, it was immediately obvious to me, than Ian really (and I do mean really) knew how to use the Expression API within .NET. This namespace has always intrigued me, so I talked to Ian about the merits of writing a joint kind of article, where we would effectively come up with some scenarios to solve using the Expression API.
Ian said he would be more than happy to write the code to any scenarios I could come up with, if I was happy to do the article writing side of things. This seemed a very fair way to do it, so we have done just that.
Now you may be asking what is so cool about the Expression API, well one thing I quite like is that you can literally write entire programs in it, and another thing that you see time and time again, is creating compiled lambda expressions that have been built up on the fly, which compile down to a delegate, so provide uber fast performance when compared to reflection. That is why the Expresson API can be useful (at least we feel that way).
That is essentially what the associated article is all about, we have a bunch of scenarios that I came up with (which I hope are good ones) which Ian has coded up. The examples range from simple property get/set through to some rather complex examples where we show you how to do things like how to create If-Then-Else Expressions and compute a HashCode for an object based of its property values.
Here is a list of the scenarios we will be covering
- Change tracker
- Generic object HashCode computation
- Property get/set
- Dynamic where
Want to know more please read the full article over here