as
The C# team posts answers to common questions and describes new language features
Using the as operator differs from a cast in C# in three important ways:
null
There are in fact two completely different operations defined in IL that handle these two keywords (the castclass and isinst instructions) - it's not just "syntactic sugar" written by C# to get this different behavior. The as operator appears to be slightly faster in v1.0 and v1.1 of Microsoft's CLR compared to casting (even in cases where there are no invalid casts which would severely lower casting's performance due to exceptions).
castclass
isinst
[Author: Jon Skeet]
PingBack from http://www.keyongtech.com/462116-c-with-cf-and-casting
PingBack from http://sdesmedt.wordpress.com/2009/02/01/what-did-we-learn-this-week-week-of-26-januari-2009/