Tuesday, 10 July 2007

Properties / Fields and the JIT

Following on from my previous posts.

I seem to be spending to much time talking about properties but I feel it is important to get a deep understanding of what is going on.

The final point I wish to get back to is that when discussing Properties Vs Fields, I indicated there is a slight performance hit when using a property rather than a field, since a property is really a method.

Whilst this is true in debug mode, it is not true when released.

The reason for this is that our friend the JIT, will replace all calls to property methods with the actual code.

Therefore in my very humble opinion, there is less and less of a reason to use
fields, rather than properties (especially in a world of automatic properties)

No comments: