22

You can use it to imitate return type covariance. Eric Lippert's Explanation . Eric provides this example code: abstract class Enclosure { protected abstract Animal GetContents(); public Animal Contents() { return this.GetContents(); } } class Aquarium : Enclosure { public new Fish Contents() { ... } protected override Animal GetContents() ...


4

I think it is there in case you might need it to do something the language designers might not have thought of. C# was in many ways a reaction to early versions of java. And one thing java did was to very explicitly pigeonhole developers to eliminate possiblities of developers shooting themselves in the feet. C# took a slightly different approach and gave ...


3

I don't like this bit: void Equip(Equipment equipment) { ...(check if equipment inherits from or is of type T) } And that's the same thing @MikeSW apparently meant, but didn't elaborate and got downvoted. If you have generics (reified at that, in C#), why do you leave type-checking until runtime? The equip function has code to determine if the ...


3

It's telling the reader that "I deliberately hid the base class' implementation of this method", as opposed to accidentally.


Only top voted, non community-wiki answers of a minimum length are eligible