Difference between Custom Controls, User controls and Components in C#: Both User control and custom control are direct or indirect derivations of Control class. Control, in turn, is derived from the component.See the derivation in below lines.
public class Component : MarshalByRefObject, IComponent, IDisposable
public class Control : Component, IDropTarget, ISynchronizeInvoke, IWin32Window,
IBindableComponent,IComponent, IDisposable
From this, it is easy to understand that the controls are much richer than components feature wise.
Components don’t have GUI like user controls or custom controls.Components are more of APIs.Examples of .NET components are Timer controls, File Browser, Data Source controls etc. A component can’t contain controls inside it.
In detail the derivation hierarchy of UserControl, Custom Control and Component is shown below
//UserControl public partial class UserControl1 : UserControl //UserControl1 is your control which is derived from UserControl public class UserControl : ContainerControl public class ContainerControl : ScrollableControl, IContainerControl public class ScrollableControl : Control, IComponent, IDisposable public class Control : Component, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable
//CustomControl public partial class SpecialButton : Button //SpecialButton is your custom control which is derived from Button public class Button : ButtonBase, IButtonControl public abstract class ButtonBase : Control public class Control : Component, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable
//Component public partial class YourComponent : Component //YourComponent is your derived from Component public class Component : MarshalByRefObject, IComponent, IDisposable
OWIN (Open Web Interface for .NET) is an interface between web servers and web applications…
JSON (JavaScript Object Notation) is a commonly used data exchange format that facilitates data exchange…
The CAP theorem is also known as Brewer's theorem. What is CAP Theorem? CAP theorem…
Some of the Key factors that need to consider while architecting or designing a software…
The Interface Segregation Principle (ISP) is one of the SOLID principles of object-oriented design. The…
The Single Responsibility Principle (SRP), also known as the Singularity Principle, is a software design…