C# - What is a component and how is it typically used?

Brad picture Brad · Feb 7, 2009 · Viewed 28.5k times · Source

What is a component class and where would I typically use one?

When I add a new item to my project in VS.NET 2008 one of the options is to add a component. I am not even sure I understand what a component is - but I would sure like to find out a bit more about them.

Could somebody explain them to me or perhaps point me towards an online tutorial that would help me.

Answer

casperOne picture casperOne · Feb 7, 2009

Well, generally speaking, a component is any part of a thing. Specifically in .NET, a component is a class that implements the IComponent interface, which indicates that a class can interact with it's logical container.

More often than not, you see this in the form of design support, in that classes interact with their host in the designer, but that's not a strict requirement.