Saturday, July 19, 2008

Chapter 1, Lesson 4

Hi .NET fans

Today I convered the lesson on Converting Between types.
It was a rather short lesson, so there won't be much to tell.

The lesson covered implicit and explicit converion rules and possibilities.

It also addressed best practices to avoid unnecessary boxing and unboxing which was quite cool.
To elaborate, when you do this: int i = 1; Object o; o = (object) i; you are converting a value type to a reference type, which is boxing. Unboxing is the opposite.

This technique involves overhead and should be avoided whenever possible.

So, this was the last lesson of the 1st chapter. Next time, I'll do the chapter review and the chapter case.

Fortunately for me it's raining cats and dogs, so I won't be demotivated by the sun shining outside. ;-)

Stay tuned...

No comments: