public class Container : IContainer, IDisposable
|
Containers are objects that encapsulate and track zero or more components. In this context, containment refers to logical containment, not visual containment. You can use components and containers in a variety of scenarios, including scenarios that are both visual and not visual.
The components in a container are tracked in a first-in, first-out list, which also defines the order of the components within the container. Added components are appended to the end of the list.
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. |
Components | Read-only Gets all the components in the Container. |
Add | Overloaded:Add(IComponent component) Adds the specified Component to the Container. The component is unnamed. |
Add | Overloaded:Add(IComponent component, string name) Adds the specified Component to the Container and assigns it a name. |
Dispose | Overloaded:Dispose() Releases all resources used by the Container. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
Remove | Removes a component from the Container. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
CreateSite | Creates a site ISite for the given IComponent and assigns the given name to the site. |
Dispose | Overloaded:Dispose(bool disposing) Releases the unmanaged resources used by the Container and optionally releases the managed resources. |
Finalize | Overridden: |
GetService | Gets the service object of the specified type, if it is available. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public Container(); |
public virtual ComponentCollection Components {get;}
|
The components in the collection are stored in the same order as they were added to the Container.
public virtual void Add( |
component
The new Component is added to the end of the list.
public virtual void Add( |
component
name
-or-
null that leaves the component unnamed.
The unique, case insensitive name to assign to the component.-or-
null that leaves the component unnamed.
Exception Type | Condition |
---|---|
ArgumentException | The name parameter is a duplicate. |
The new Component is added to the end of the list.
protected virtual ISite CreateSite( |
component
name
This method can be overridden by a derived class. Implementors wishing to override Container.CreateSite can provide a custom implementation through a class implementing ISite.
public void Dispose(); |
protected virtual void Dispose( |
disposing
For more information about Dispose and Object.Finalize, see the conceptual topic at MSDN: cleaningupunmanagedresources and the conceptual topic at MSDN: overridingfinalizemethod.
This method is called by the public Dispose method and the Object.Finalize method.Dispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. Object.Finalize invokes Dispose with disposing set to false.
When the disposing parameter is true, this method releases all resources held by any managed objects that this Container references. This method invokes the Dispose() method of each referenced object.
For more information about Dispose and Object.Finalize, see the conceptual topic at MSDN: cleaningupunmanagedresources and the conceptual topic at MSDN: overridingfinalizemethod.
~Container(); |
public virtual int GetHashCode(); |
service
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual void Remove( |
component
public virtual string ToString(); |