Share via


XRObservableCollection.RemoveItemImpl(int) (Compact 2013)

3/28/2014

This protected method implements collection operations for removing items from the data source collection and invokes XRObservableCollection.OnCollectionChanged(XRCollectionChangedCustomEventArgs *) to send an event notification that the collection has changed.

Syntax

HRESULT STDMETHODCALLTYPE RemoveItemImpl(
int nIndex)

Parameters

  • nIndex
    [in] The index of the item in the collection to remove.

Return Value

The following table shows the possible return values.

Value

Description

S_OK

The method was successful.

E_FAIL

The method was unsuccessful.

E_BUSY

The collection is currently being updated.

E_OUTOFMEMORY

The method exceeded its available memory.

E_POINTER

The method cannot access the item to remove.

The E_OUTOFMEMORY value is returned when the system does not have enough memory to create an internal instance of the collection object.

The E_OUTOFMEMORY and E_FAIL values are returned in two different situations:

  • E_OUTOFMEMORY is returned if the method was able to process the input parameter for the internal call to create an instance; however, the method was unable to create the instance by using the input parameter.
  • E_FAIL is returned by the method’s internal call to create an instance if none of its if statements were evaluated by the method. When E_FAIL is returned, none of the code in the internal call to create an instance was processed.

Remarks

The inherited method XRValueCollectionT.Remove(const ItemType&) internally calls the RemoveItemsImpl method to execute the functionality to remove items from the data source collection. You can override this method to provide a customized implementation of removing items from the collection.

Because XRObservableCollection.RemoveItemImpl is a protected member, an instance of XRObservableCollection<ItemType> cannot directly access the XRObservableCollection.RemoveItemImpl method.

If you derive a new class from XRObservableCollection<ItemType> that uses either public or protected access modifiers, you can override this method in the new class.

Requirements

Header

XRCollection.h

See Also

Reference

XRObservableCollection<ItemType>