CHStringArray::RemoveAt method

[The CHStringArray class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]

The RemoveAt method removes one or more elements starting at a specified index in an array.

Syntax

void RemoveAt(
  int nIndex,
  int nCount
);

Parameters

nIndex

An integer index that is greater than or equal to zero and less than or equal to the value returned by GetUpperBound.

nCount

The number of elements to remove. The default is 1 (one).

Return Value

This method does not return a value.

Remarks

In the process of removing elements, RemoveAt shifts down all the elements located above the elements that are removed. This method decrements the upper bound of the array but does not free memory.

Examples

The following code example shows the use of CHStringArray::RemoveAt.

C++
CHStringArray array;

array.Add( L"String 1" ); // Element 0 array.Add( L"String 2" ); // Element 1 array.RemoveAt( 0 ); // Element 1 moves to 0. assert ( array[0] == L"String 2" );

The results from this program are as follows.
C++
[0] = String 2

Requirements

   
Windows version Windows Vista Windows Server 2008
Target Platform Windows
Header chstrarr.h (include FwCommon.h)
Library FrameDyn.lib
DLL FrameDynOS.dll; FrameDyn.dll

See Also

CHStringArray

CHStringArray::Add

CHStringArray::GetAt

CHStringArray::InsertAt