When you want to change types most of the time you just want to use the traditional cast.
var value = (string)dictionary[key];
It's good because:
- It’s fast
- It’ll complain if something is wrong (instead of giving object is null exceptions)
So what is a good example for the use of as
I couldn't really find or think of something that suits it perfectly?
Note: Actually I think sometimes there are cases where the complier prevents the use of a cast where as
works (generics related?).