mscorlib(4.0.0.0) API with additions
System.ComponentModel.Container Class Reference

Encapsulates zero or more components. More...

Inheritance diagram for System.ComponentModel.Container:
[legend]
Collaboration diagram for System.ComponentModel.Container:
[legend]

Public Member Functions

virtual void Add (IComponent component)
 Adds the specified T:System.ComponentModel.Component to the T:System.ComponentModel.Container. The component is unnamed. More...
 
virtual void Add (IComponent component, string name)
 Adds the specified T:System.ComponentModel.Component to the T:System.ComponentModel.Container and assigns it a name. More...
 
void Dispose ()
 Releases all resources used by the T:System.ComponentModel.Container. More...
 
virtual void Remove (IComponent component)
 Removes a component from the T:System.ComponentModel.Container. More...
 

Protected Member Functions

virtual ISite CreateSite (IComponent component, string name)
 Creates a site T:System.ComponentModel.ISite for the given T:System.ComponentModel.IComponent and assigns the given name to the site. More...
 
virtual void Dispose (bool disposing)
 Releases the unmanaged resources used by the T:System.ComponentModel.Container, and optionally releases the managed resources. More...
 
virtual object GetService (Type service)
 Gets the service object of the specified type, if it is available. More...
 
void RemoveWithoutUnsiting (IComponent component)
 Removes a component from the T:System.ComponentModel.Container without setting P:System.ComponentModel.IComponent.Site to null. More...
 
virtual void ValidateName (IComponent component, string name)
 Determines whether the component name is unique for this container. More...
 

Properties

virtual ComponentCollection Components [get]
 Gets all the components in the T:System.ComponentModel.Container. More...
 
- Properties inherited from System.ComponentModel.IContainer
ComponentCollection Components [get]
 Gets all the components in the T:System.ComponentModel.IContainer. More...
 

Detailed Description

Encapsulates zero or more components.

Definition at line 7 of file Container.cs.

Member Function Documentation

◆ Add() [1/2]

virtual void System.ComponentModel.Container.Add ( IComponent  component)
virtual

Adds the specified T:System.ComponentModel.Component to the T:System.ComponentModel.Container. The component is unnamed.

Parameters
componentThe component to add.
Exceptions
T:System.ArgumentNullExceptioncomponent is null.

Implements System.ComponentModel.IContainer.

Definition at line 117 of file Container.cs.

◆ Add() [2/2]

virtual void System.ComponentModel.Container.Add ( IComponent  component,
string  name 
)
virtual

Adds the specified T:System.ComponentModel.Component to the T:System.ComponentModel.Container and assigns it a name.

Parameters
componentThe component to add.
nameThe unique, case-insensitive name to assign to the component.-or- null, which leaves the component unnamed.
Exceptions
T:System.ArgumentNullExceptioncomponent is null.
T:System.ArgumentExceptionname is not unique.

Implements System.ComponentModel.IContainer.

Definition at line 130 of file Container.cs.

◆ CreateSite()

virtual ISite System.ComponentModel.Container.CreateSite ( IComponent  component,
string  name 
)
protectedvirtual

Creates a site T:System.ComponentModel.ISite for the given T:System.ComponentModel.IComponent and assigns the given name to the site.

Parameters
componentThe T:System.ComponentModel.IComponent to create a site for.
nameThe name to assign to component , or null to skip the name assignment.
Returns
The newly created site.

Reimplemented in System.ComponentModel.NestedContainer.

Definition at line 167 of file Container.cs.

◆ Dispose() [1/2]

void System.ComponentModel.Container.Dispose ( )

Releases all resources used by the T:System.ComponentModel.Container.

Implements System.IDisposable.

Definition at line 173 of file Container.cs.

◆ Dispose() [2/2]

virtual void System.ComponentModel.Container.Dispose ( bool  disposing)
protectedvirtual

Releases the unmanaged resources used by the T:System.ComponentModel.Container, and optionally releases the managed resources.

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.

Reimplemented in System.ComponentModel.NestedContainer.

Definition at line 182 of file Container.cs.

◆ GetService()

virtual object System.ComponentModel.Container.GetService ( Type  service)
protectedvirtual

Gets the service object of the specified type, if it is available.

Parameters
serviceThe T:System.Type of the service to retrieve.
Returns
An T:System.Object implementing the requested service, or null if the service cannot be resolved.

Reimplemented in System.ComponentModel.NestedContainer.

Definition at line 203 of file Container.cs.

◆ Remove()

virtual void System.ComponentModel.Container.Remove ( IComponent  component)
virtual

Removes a component from the T:System.ComponentModel.Container.

Parameters
componentThe component to remove.

Implements System.ComponentModel.IContainer.

Definition at line 214 of file Container.cs.

◆ RemoveWithoutUnsiting()

void System.ComponentModel.Container.RemoveWithoutUnsiting ( IComponent  component)
protected

Removes a component from the T:System.ComponentModel.Container without setting P:System.ComponentModel.IComponent.Site to null.

Parameters
componentThe component to remove.

Definition at line 256 of file Container.cs.

◆ ValidateName()

virtual void System.ComponentModel.Container.ValidateName ( IComponent  component,
string  name 
)
protectedvirtual

Determines whether the component name is unique for this container.

Parameters
componentThe named component.
nameThe component name to validate.
Exceptions
T:System.ArgumentNullExceptioncomponent is null.
T:System.ArgumentExceptionname is not unique.

Definition at line 268 of file Container.cs.

Property Documentation

◆ Components

virtual ComponentCollection System.ComponentModel.Container.Components
get

Gets all the components in the T:System.ComponentModel.Container.

Returns
A collection that contains the components in the T:System.ComponentModel.Container.

Definition at line 71 of file Container.cs.


The documentation for this class was generated from the following file: