WLT documentation has moved.

We are publishing both conceptual docs and API references on docs.microsoft.com. For conceptual docs, please visit our new landing page. For API references, please visit the Core WLT section of the dot net API explorer and related pages. Existing content will remain here but will not be updated further.

Search Results for

    Show / Hide Table of Contents

    Class ResourceMirror

    Class to synchronize a list of resources with associated source data (items).

    Inheritance
    Object
    ResourceMirror
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.MixedReality.WorldLocking.Core
    Assembly: cs.temp.dll.dll
    Syntax
    public class ResourceMirror

    Methods

    Sync<ItemType, ResourceType>(IReadOnlyList<ItemType>, List<ResourceType>, ResourceMirror.CompareToResource<ItemType, ResourceType>, ResourceMirror.CreateResource<ItemType, ResourceType>, ResourceMirror.UpdateResource<ItemType, ResourceType>, ResourceMirror.DestroyResource<ResourceType>)

    Given a sorted list of source data items (currentItems), and a sorted list of resources: For each source item that doesn't have a matching resource, attempt to create a resource. For each resource that doesn't have a matching source item, destroy that resource. For each source item with a matching resource, update the resource.

    Declaration
    public static void Sync<ItemType, ResourceType>(IReadOnlyList<ItemType> currentItems, List<ResourceType> resources, ResourceMirror.CompareToResource<ItemType, ResourceType> compareIds, ResourceMirror.CreateResource<ItemType, ResourceType> creator, ResourceMirror.UpdateResource<ItemType, ResourceType> updater, ResourceMirror.DestroyResource<ResourceType> destroyer)
    Parameters
    Type Name Description
    IReadOnlyList<ItemType> currentItems

    List of current source items.

    List<ResourceType> resources

    List of resources to by synced to currentItems.

    ResourceMirror.CompareToResource<ItemType, ResourceType> compareIds

    Function to compare an item with a resource. See above.

    ResourceMirror.CreateResource<ItemType, ResourceType> creator

    Callback to create a missing resource. See above.

    ResourceMirror.UpdateResource<ItemType, ResourceType> updater

    Callback to update an existing resource. See above.

    ResourceMirror.DestroyResource<ResourceType> destroyer

    Callback to destroy a resource which no longer has a matching source item.

    Type Parameters
    Name Description
    ItemType

    Type of source items.

    ResourceType

    Type of resources.

    Remarks

    After this Sync, the list of resources will have exactly one resource for each item in currentItems, and currentItems and resources will be the same length. The exception is if the creator function returns false for any item(s), then those item(s) will not have matching resources, and resources will be shorter than currentItems. In any case, resources will remain sorted. Sync completes in a single pass over the data, so in O(max(currentItems.Count, resources.Count)) time.

    In This Article
    Back to top Generated by DocFX