Show / Hide Table of Contents

Interface ILifetimeContainer

Represents a lifetime container.

Inherited Members
IEnumerable<Object>.GetEnumerator()
IDisposable.Dispose()
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 Source

Container

The container that this context is associated with.

Declaration
IUnityContainer Container { get; }
Property Value
Type Description
IUnityContainer

The IUnityContainer object.

| Improve this Doc View Source

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 Source

Add(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

Extension Methods

InjectionMatching.Matches(Object, Type)
InjectionMatching.MatchesObject(Object, Type)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2020 .NET Foundation and Contributors. All Rights Reserved