VB.NET Keyword of the Week: DirectCast

I'm starting a new series of blog entries - a weekly keyword in VB.NET that I find interesting, and that some of you may not be aware of.

This weeks word: DirectCast. If you've been using CType to convert values, as in var=CType(expression, typename), consider using DirectCast instead. You can use DirectCast as long as the run-time type of the object variable is the same as the specified type, rather than merely having a valid conversion defined. You'll get better performance. Check out the documentation on DirectCast for more details.