Extend Javascript promise and resolve or reject it inside constructor

The reasoning is simple but not necessarily self evident. .then() returns a promise if then is called on a subclass of Promise, the returned promise is an instance of the subclass, not Promise itself. the then returned promise is constructed by calling the subclass constructor, and passing it an internal executor function that records the … Read more

Why can’t I call an extension method from a base class of the extended type‏?

Consider this situation: public class Base { public void BaseMethod() { } } public class Sub : Base { public void SubMethod() { } } public static class Extensions { public static void ExtensionMethod(this Base @base) { } } Here are some interesting assertions about this code: I cannot call the extension method using ExtensionMethod() … Read more