Class ServiceCollection
Default implementation of IServiceCollection.
Implements
Inherited Members
Namespace: Unity.AppUI.MVVM
Assembly: Unity.AppUI.MVVM.dll
Syntax
public class ServiceCollection : IServiceCollection, IList<ServiceDescriptor>, ICollection<ServiceDescriptor>, IEnumerable<ServiceDescriptor>, IEnumerable
Properties
Count
The number of services in the collection.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
IsReadOnly
The collection is not read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool |
this[int]
Get or set a service in the collection.
Declaration
public ServiceDescriptor this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the service to get or set. |
Property Value
Type | Description |
---|---|
ServiceDescriptor |
Methods
Add(ServiceDescriptor)
Add a service to the collection.
Declaration
public void Add(ServiceDescriptor item)
Parameters
Type | Name | Description |
---|---|---|
ServiceDescriptor | item | The service to add. |
Clear()
Clear all services from the collection.
Declaration
public void Clear()
Contains(ServiceDescriptor)
Check if the collection contains a service.
Declaration
public bool Contains(ServiceDescriptor item)
Parameters
Type | Name | Description |
---|---|---|
ServiceDescriptor | item | The service to check for. |
Returns
Type | Description |
---|---|
bool | True if the collection contains the service. |
CopyTo(ServiceDescriptor[], int)
Copy the services to an array.
Declaration
public void CopyTo(ServiceDescriptor[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
ServiceDescriptor[] | array | The array to copy to. |
int | arrayIndex | The index to start copying at. |
GetEnumerator()
Get an enumerator for the services.
Declaration
public IEnumerator<ServiceDescriptor> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<ServiceDescriptor> | The enumerator. |
IndexOf(ServiceDescriptor)
Get the index of a service in the collection.
Declaration
public int IndexOf(ServiceDescriptor item)
Parameters
Type | Name | Description |
---|---|---|
ServiceDescriptor | item | The service to get the index of. |
Returns
Type | Description |
---|---|
int | The index of the service. |
Insert(int, ServiceDescriptor)
Insert a service into the collection.
Declaration
public void Insert(int index, ServiceDescriptor item)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index to insert the service at. |
ServiceDescriptor | item | The service to insert. |
Remove(ServiceDescriptor)
Remove a service from the collection.
Declaration
public bool Remove(ServiceDescriptor item)
Parameters
Type | Name | Description |
---|---|---|
ServiceDescriptor | item | The service to remove. |
Returns
Type | Description |
---|---|
bool | True if the service was removed. |
RemoveAt(int)
Remove a service from the collection.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the service to remove. |