Wednesday, August 15, 2007

Boxing/UnBoxing Continued

Since my last post I ran across some new questions.
1. Does boxing have a performance issue or UnBoxing?
2. In case when an int has to be concatenated with string is it better to use ToString() method.

After running some tests I have concluded.
Boxing is slower than UnBoxing and ToString() is slower than boxing. So if one cannot avoid boxing do not try to use ToString() methods they seem to be slower.

My current challenge is that I have a Winform screen with 15 drop downs and 6 grids. In order to bind the the controls I am converting strongly typed Business entities to DataTables. There are quite a few properties in the business entities which are int and DateTime resulting in boxing and impacting the performance of the screens.

Hopefully I will come up with a solution to this issue soon.

No comments:

Post a Comment