Class ServiceCollection
Implements the IServiceCollection interface.
Inheritance
System.Object
ServiceCollection
Implements
System.Collections.Generic.ICollection<AbstractServiceEntry>
System.Collections.Generic.IEnumerable<AbstractServiceEntry>
System.Collections.IEnumerable
Namespace: Solti.Utils.DI
Assembly: Solti.Utils.DI.dll
Syntax
public sealed class ServiceCollection : Object, IServiceCollection
Constructors
ServiceCollection(Boolean)
Creates a new ServiceCollection instance.
Declaration
public ServiceCollection(bool supportsOverride = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | supportsOverride |
Properties
Count
Number of entries in this list.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsReadOnly
This list is
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
SupportsOverride
Returns true if service overriding is supported.
Declaration
public bool SupportsOverride { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Add(AbstractServiceEntry)
Adds a new entry to this collection.
Declaration
public void Add(AbstractServiceEntry item)
Parameters
Type | Name | Description |
---|---|---|
AbstractServiceEntry | item |
Exceptions
Type | Condition |
---|---|
ServiceAlreadyRegisteredException | If SupportsOverride is false and this list already contains an entry with the given id |
Clear()
Clears this list.
Declaration
public void Clear()
Contains(AbstractServiceEntry)
Check entry existance by reference.
Declaration
public bool Contains(AbstractServiceEntry item)
Parameters
Type | Name | Description |
---|---|---|
AbstractServiceEntry | item |
Returns
Type | Description |
---|---|
System.Boolean |
Contains(IServiceId)
Check entry existance by id.
Declaration
public bool Contains(IServiceId id)
Parameters
Type | Name | Description |
---|---|---|
IServiceId | id |
Returns
Type | Description |
---|---|
System.Boolean |
CopyTo(AbstractServiceEntry[], Int32)
Copies the contained entries to an array.
Declaration
public void CopyTo(AbstractServiceEntry[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
AbstractServiceEntry[] | array | |
System.Int32 | arrayIndex |
GetEnumerator()
Enumerates the entries in this collection.
Declaration
public IEnumerator<AbstractServiceEntry> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<AbstractServiceEntry> |
MakeReadOnly()
Makes this collection read only.
Declaration
public void MakeReadOnly()
Remove(AbstractServiceEntry)
Drops entry by reference.
Declaration
public bool Remove(AbstractServiceEntry item)
Parameters
Type | Name | Description |
---|---|---|
AbstractServiceEntry | item |
Returns
Type | Description |
---|---|
System.Boolean |
Remove(IServiceId)
Drops entry by id.
Declaration
public bool Remove(IServiceId id)
Parameters
Type | Name | Description |
---|---|---|
IServiceId | id |
Returns
Type | Description |
---|---|
System.Boolean |
TryFind(IServiceId)
Tries to find an entry by id.
Declaration
public AbstractServiceEntry TryFind(IServiceId id)
Parameters
Type | Name | Description |
---|---|---|
IServiceId | id |
Returns
Type | Description |
---|---|
AbstractServiceEntry |
Implements
System.Collections.Generic.ICollection<>
System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable