docs.unity3d.com
    Show / Hide Table of Contents

    Class ServiceCollection

    Default implementation of IServiceCollection.

    Inheritance
    Object
    ServiceCollection
    AppUIServiceCollection
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.AppUI.MVVM
    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
    Int32
    Implements
    ICollection<T>.Count

    IsReadOnly

    The collection is not read-only.

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    Boolean
    Implements
    ICollection<T>.IsReadOnly

    Item[Int32]

    Get or set a service in the collection.

    Declaration
    public ServiceDescriptor this[int index] { get; set; }
    Parameters
    Type Name Description
    Int32 index

    The index of the service to get or set.

    Property Value
    Type Description
    ServiceDescriptor
    Implements
    IList<T>.Item[Int32]

    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.

    Implements
    ICollection<T>.Add(T)

    Clear()

    Clear all services from the collection.

    Declaration
    public void Clear()
    Implements
    ICollection<T>.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
    Boolean

    True if the collection contains the service.

    Implements
    ICollection<T>.Contains(T)

    CopyTo(ServiceDescriptor[], Int32)

    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.

    Int32 arrayIndex

    The index to start copying at.

    Implements
    ICollection<T>.CopyTo(T[], Int32)

    GetEnumerator()

    Get an enumerator for the services.

    Declaration
    public IEnumerator<ServiceDescriptor> GetEnumerator()
    Returns
    Type Description
    IEnumerator<ServiceDescriptor>

    The enumerator.

    Implements
    IEnumerable<T>.GetEnumerator()

    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
    Int32

    The index of the service.

    Implements
    IList<T>.IndexOf(T)

    Insert(Int32, ServiceDescriptor)

    Insert a service into the collection.

    Declaration
    public void Insert(int index, ServiceDescriptor item)
    Parameters
    Type Name Description
    Int32 index

    The index to insert the service at.

    ServiceDescriptor item

    The service to insert.

    Implements
    IList<T>.Insert(Int32, T)

    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
    Boolean

    True if the service was removed.

    Implements
    ICollection<T>.Remove(T)

    RemoveAt(Int32)

    Remove a service from the collection.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    Int32 index

    The index of the service to remove.

    Implements
    IList<T>.RemoveAt(Int32)

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Get an enumerator for the services.

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    The enumerator.

    Implements
    IEnumerable.GetEnumerator()

    Extension Methods

    ServicesCollectionExtensions.AddSingleton<T>(IServiceCollection)
    ServicesCollectionExtensions.AddSingleton<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.AddSingleton(IServiceCollection, Type)
    ServicesCollectionExtensions.AddSingleton(IServiceCollection, Type, Type)
    ServicesCollectionExtensions.TryAddSingleton<TService>(IServiceCollection)
    ServicesCollectionExtensions.TryAddSingleton<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.AddTransient<T>(IServiceCollection)
    ServicesCollectionExtensions.AddTransient<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.AddTransient(IServiceCollection, Type)
    ServicesCollectionExtensions.AddTransient(IServiceCollection, Type, Type)
    ServicesCollectionExtensions.BuildServiceProvider(IServiceCollection)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023