Casting - What's the difference between "(myObject)something" and "something As myObject" in C#?
- by SLC
I've encountered this a couple of times and been perplexed.
Cat c = new Cat("Fluffy");
return (Animal)c;
Cat c = new Cat("Fluffy");
return c as Animal;
What's the reason for both of these syntaxes to exist?