Abstract UserControl inheritance in Visual Studio designer

What we want First, let’s define the final class and the base abstract class. public class MyControl : AbstractControl … public abstract class AbstractControl : UserControl // Also works for Form … Now all we need is a Description provider. public class AbstractControlDescriptionProvider<TAbstract, TBase> : TypeDescriptionProvider { public AbstractControlDescriptionProvider() : base(TypeDescriptor.GetProvider(typeof(TAbstract))) { } public override … Read more

Class Mapping Error: ‘T’ must be a non-abstract type with a public parameterless constructor

The problem is that you’re trying to use the T from SqlReaderBase as the type argument for MapperBase – but you don’t have any constraints on that T. Try changing your SqlReaderBase declaration to this: public abstract class SqlReaderBase<T> : ConnectionProvider where T : new() Here’s a shorter example which demonstrates the same issue: class … Read more

Does ECMAScript 6 have a convention for abstract classes? [duplicate]

ES2015 does not have Java-style classes with built-in affordances for your desired design pattern. However, it has some options which may be helpful, depending on exactly what you are trying to accomplish. If you would like a class that cannot be constructed, but whose subclasses can, then you can use new.target: class Abstract { constructor() … Read more

When to use interfaces or abstract classes? When to use both?

As a first rule of thumb, I prefer abstract classes over interfaces, based on the .NET Design Guidelines. The reasoning applies much wider than .NET, but is better explained in the book Framework Design Guidelines. The main reasoning behind the preference for abstract base classes is versioning, because you can always add a new virtual … Read more