Share via


ResourceMirror.CreateResource<ItemType,ResourceType> 委托

定义

用于创建与特定项匹配的资源的新实例的回调。 这将针对 Sync 的 currentItems 列表中的每个项调用,这些项在 Sync 的资源列表中没有匹配的资源。

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 

类型参数

ItemType

源数据的类型。

ResourceType

要管理的资源的类型。

参数

item
ItemType

要为其创建新资源的源项。

resource
ResourceType

为创建的资源输出参数。

返回值

如果成功创建资源,则返回 true。

注解

请注意,返回 false 不是错误,它仅表示由于任何原因未创建资源。 但是,如果未创建资源,则在对 Sync 的下一次调用中,将注意到该项没有匹配的资源,并且将再次进行创建调用。 若要防止无果且可能代价高昂的创建调用,应从传递到 Sync 的项目列表中删除有问题的项。如下所述,项目列表中的所有添加和删除操作都必须在同步调用之外发生。

适用于