Re:C#: No, you don’t get to use the “as” operator any more
by mendicant on Friday April 29, 2011 @04:21PM
(#2498836)
That's part of it. But the author should articulate it.
There is also certain (specific) situations where the original code (e.NewItem as Customer).Save() would fail but ((Customer)e.NewItem).Save() wouldn't. That specific case is where the type of e.NewItem has an implicit cast to Customer (as would return null, but a (Customer) cast would work).
But if you're doing implicit casting you might be facing other issues.
There is also certain (specific) situations where the original code (e.NewItem as Customer).Save() would fail but ((Customer)e.NewItem).Save() wouldn't. That specific case is where the type of e.NewItem has an implicit cast to Customer (as would return null, but a (Customer) cast would work).
But if you're doing implicit casting you might be facing other issues.