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)

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