Container 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
封裝零個或多個元件。
public ref class Container : IDisposable, System::ComponentModel::IContainer
public ref class Container : System::ComponentModel::IContainer
C#
public class Container : IDisposable, System.ComponentModel.IContainer
C#
public class Container : System.ComponentModel.IContainer
type Container = class
interface IContainer
interface IDisposable
Public Class Container
Implements IContainer, IDisposable
Public Class Container
Implements IContainer
- 繼承
-
Container
- 衍生
- 實作
類別 Container 是 介面的預設實作 IContainer 。
容器是封裝和追蹤零個或多個元件的物件。 在此內容中,內含專案是指邏輯內含專案,而不是視覺內含專案。 您可以在各種案例中使用元件和容器,包括視覺效果而非視覺效果的案例。
容器中的元件會在先進先出清單中追蹤,這也會定義容器內元件的順序。 新增的元件會附加至清單結尾。
Container() |
初始化 Container 類別的新執行個體。 |
Components |
取得 Container 中的所有元件。 |
Add(IComponent) | |
Add(IComponent, String) | |
Create |
為指定的 ISite 建立站台 IComponent,並將指定的名稱指派給站台。 |
Dispose() |
釋放 Container 所使用的所有資源。 |
Dispose(Boolean) |
釋放 Container 所使用的 Unmanaged 資源,並選擇性釋放 Managed 資源。 |
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
Finalize() |
釋出 Unmanaged 資源並執行其他清除作業後,記憶體回收才能重新回收 Container。 |
Get |
做為預設雜湊函式。 (繼承來源 Object) |
Get |
取得指定型別的服務物件 (如果有的話)。 |
Get |
取得目前執行個體的 Type。 (繼承來源 Object) |
Memberwise |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
Remove(IComponent) |
從 Container 移除元件。 |
Remove |
|
To |
傳回代表目前物件的字串。 (繼承來源 Object) |
Validate |
判斷元件名稱對這個容器而言是否唯一。 |
產品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |