I just read an extremely interesting article on CodeProject called: Fast Dynamic Property Access with C# by James Nies. Wow, I am really impressed both by the idea to use Emit in this genius way and by the coding style. Very nice work.

So, I had to sit down and port it to .NET 2.0 and use Generics. Actually, what I found out – it is way simpler, than what he did. ;) How fortunate for me, since this was the very first time I even looked at Emit.

Please remember: This is a quick port. It won’t work, if you don’t know exactly the return type, especially if it is a ValueType.

Here are links to download the stuff:

GenericPropertyAccessor as Zip

Or as txts:
IGenericPropertyAccessor.cs
GenericPropertyAccessor.cs
And finally the updated test app:
SampleApp.cs

This is not the complete solution you need in order to build the SampleApp. Please go to Codeproject and download the source code, then add my files.