C# - 什么是组件,它通常如何使用?

C# - What is a component and how is it typically used?(C# - 什么是组件,它通常如何使用?)

本文介绍了C# - 什么是组件,它通常如何使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是组件类,我通常会在哪里使用它?

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

当我在 VS.NET 2008 中向我的项目添加新项目时,其中一个选项是添加组件.我什至不确定我是否了解组件是什么 - 但我肯定想了解更多关于它们的信息.

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.

推荐答案

嗯,一般来说,组件是事物的任何部分.特别是在 .NET 中,组件是一个实现 IComponent接口,表示一个类可以和它的逻辑容器交互.

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.

这篇关于C# - 什么是组件,它通常如何使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:C# - 什么是组件,它通常如何使用?

基础教程推荐