ResourceMirror.CreateResource<ItemType,ResourceType> Delegate

Definition

Callback for creating a new instance of a resource matching a specific item. This will be called for each item in Sync's currentItems list which doesn't have a matching resource in Sync's resources list.

public delegate bool ResourceMirror.CreateResource<ItemType,ResourceType>(ItemType item, out ResourceType resource);
type ResourceMirror.CreateResource<'ItemType, 'ResourceType> = delegate of 'ItemType * 'ResourceType -> bool
Public Delegate Function ResourceMirror.CreateResource(Of ItemType, ResourceType)(item As ItemType, ByRef resource As ResourceType) As Boolean 

Type Parameters

ItemType

Type of the source data.

ResourceType

Type of the resources to be managed.

Parameters

item
ItemType

The source item to create a new resource for.

resource
ResourceType

out param for created resource.

Return Value

Returns true if a resource was created successfully.

Remarks

Note that it is not an error to return false, it only means that for any reason the resource was not created. However, if the resource is not created, then in the next call to Sync, it will be noted that the item doesn't have a matching resource and the create call will be made again. To prevent fruitless and possibly expensive create calls, the offending item should be removed from the items list passed into Sync. As noted below, all additions and removals from the items list must happen outside the Sync call.

Applies to