// One way
var t:MyClass = MyClass(o);
// Another
var t:MyClass = o as MyClass;
Ok, if it cannot be converted to MyClass, the first one will fail, i.e. you will end up with an exception flying your stack.
The second one will never be thrown if If you can’t perform proper projection, you will only end up with a null value.
I think.
What is the difference between this type of conversion expression? ? What is better?
// One way
var t:MyClass = MyClass(o);
// Another
var t:MyClass = o as MyClass;
Oh, I knew that one before…
Ok, if it can’t be converted to MyClass, the first one will fail, i.e. you will end up with an exception flying your stack.
The second one will never be thrown, if you can’t cast properly, you will only end up with one Null value.
I think.