SPPersistedChildCollection<T>.Ensure Method

Adds an object to the collection and, if the object already exists, reinitializes it with the data of the existing object.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Overridable Function Ensure ( _
    newObj As T _
) As T
'Usage
Dim instance As SPPersistedChildCollection
Dim newObj As T
Dim returnValue As T

returnValue = instance.Ensure(newObj)
public virtual T Ensure(
    T newObj
)

Parameters

  • newObj
    Type: T

    The object to add to the collection. If the object exists in the collection, it is reinitialized with the data of the existing object.

Return Value

Type: T
The object that was added or updated.

See Also

Reference

SPPersistedChildCollection<T> Class

SPPersistedChildCollection<T> Members

Microsoft.SharePoint.Administration Namespace