Hello all... I just finished writing a sample and blog article about custom serializers like the XmlSerializer or BinaryFormatter, except one that you'd write yourself from ground up.
As you can imagine, those use reflection quite a lot and reflection comes at a cost. Fortunately, there are ways to speed up reflection operations with DynamicMethod objects and IL "emission". This is what MS calls it when you inject CIL (the CLR's "assembly code") inside runtime-generated methods and hand them to the JIT compiler. It's a very powerful feature of .NET that I'm just beginning to understand.
So the sample is both about serialization, since it provides a working serializer that generates intermediate, agnostic objects from complex classes and can transform them back... but also about IL emission and how you can speed up
any reflection operations using that.
Check it out if you're interested!
http://www.theinstructionlimit.com/?p=76Sample direct link, C#3.5/VS.NET2008 :
http://www.theinstructionlimit.com/wp-content/uploads/2008/09/fastreflection.zip