docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ServiceCollection

    Default implementation of IServiceCollection.

    Inheritance
    object
    ServiceCollection
    AppUIServiceCollection
    Implements
    IServiceCollection
    IList<ServiceDescriptor>
    ICollection<ServiceDescriptor>
    IEnumerable<ServiceDescriptor>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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.

    Implements

    IServiceCollection
    IList<T>
    ICollection<T>
    IEnumerable<T>
    IEnumerable

    Extension Methods

    ServicesCollectionExtensions.AddScoped(IServiceCollection, Type)
    ServicesCollectionExtensions.AddScoped(IServiceCollection, Type, Type)
    ServicesCollectionExtensions.AddScoped<T>(IServiceCollection)
    ServicesCollectionExtensions.AddScoped<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.AddSingleton(IServiceCollection, Type)
    ServicesCollectionExtensions.AddSingleton(IServiceCollection, Type, Type)
    ServicesCollectionExtensions.AddSingleton<T>(IServiceCollection)
    ServicesCollectionExtensions.AddSingleton<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.AddTransient(IServiceCollection, Type)
    ServicesCollectionExtensions.AddTransient(IServiceCollection, Type, Type)
    ServicesCollectionExtensions.AddTransient<T>(IServiceCollection)
    ServicesCollectionExtensions.AddTransient<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.BuildServiceProvider(IServiceCollection)
    ServicesCollectionExtensions.TryAddScoped(IServiceCollection, Type)
    ServicesCollectionExtensions.TryAddScoped(IServiceCollection, Type, Type)
    ServicesCollectionExtensions.TryAddScoped<TService>(IServiceCollection)
    ServicesCollectionExtensions.TryAddScoped<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.TryAddSingleton(IServiceCollection, Type)
    ServicesCollectionExtensions.TryAddSingleton<TService>(IServiceCollection)
    ServicesCollectionExtensions.TryAddSingleton<TService, TImplementation>(IServiceCollection)
    ServicesCollectionExtensions.TryAddTransient(IServiceCollection, Type)
    ServicesCollectionExtensions.TryAddTransient(IServiceCollection, Type, Type)
    ServicesCollectionExtensions.TryAddTransient<TService>(IServiceCollection)
    ServicesCollectionExtensions.TryAddTransient<TService, TImplementation>(IServiceCollection)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)