CHStringArray::SetAt (chstrarr.h)

[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 SetAt method sets the array element at the specified index.

Syntax

void SetAt(
  int     nIndex,
  LPCWSTR newElement
);

Parameters

nIndex

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

newElement

The object pointer that is inserted in this array. A NULL value is allowed.

Return value

None

Remarks

The SetAt method does not cause the array to increase. Use SetAtGrow if you want the array to increase automatically.

You must ensure that your index value represents a valid position in the array.

Examples

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

CHStringArray array;

array.Add( L"String 1" ); // Element 0
array.Add( L"String 2" ); // Element 1
array.SetAt( 0, L"String 3" );  // Replace element 0.
assert( array[0] == "String 3" );

The following example results in a CHStringArray with two elements.

    [0] = String 3
    [1] = String 2

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server 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::ElementAt

CHStringArray::GetAt

CHStringArray::GetData

CHStringArray::operator []