Casting and calling virtual functions added.

Changes required by Microsoft .NET implementation.
Additionally readonly fields are now set using reflection
(direct setting is not working under MS.NET) - this should
be investigated in the future to boost the performance.