Interface ILifetimeContainer
Represents a lifetime container.
Namespace: Unity.Lifetime
Assembly: Unity.Abstractions.dll
Syntax
public interface ILifetimeContainer : IEnumerable<object>, IEnumerable, IDisposable
Remarks
A lifetime container tracks the lifetime of an object, and implements IDisposable. When the container is disposed, any objects in the container which implement IDisposable are also disposed.
Properties
| Improve this Doc View SourceContainer
The container that this context is associated with.
Declaration
IUnityContainer Container { get; }
Property Value
| Type | Description |
|---|---|
| IUnityContainer | The IUnityContainer object. |
Count
Gets the number of references in the lifetime container
Declaration
int Count { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | The number of references in the lifetime container |
Methods
| Improve this Doc View SourceAdd(Object)
Adds an object to the lifetime container.
Declaration
void Add(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | item | The item to be added to the lifetime container. |
Contains(Object)
Determine if a given object is in the lifetime container.
Declaration
bool Contains(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | item | The item to locate in the lifetime container. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the object is contained in the lifetime container; returns false otherwise. |
Remove(Object)
Removes an item from the lifetime container. The item is not disposed.
Declaration
void Remove(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | item | The item to be removed. |