Condividi tramite


CArray::GetCount

Returns the number of array elements.

INT_PTR GetCount( ) const;

Return Value

The number of items in the array.

Remarks

Call this method to retrieve the number of elements in the array. Because indexes are zero-based, the size is 1 greater than the largest index. Calling this method will generate the same result as the CArray::GetSize method.

Example

CArray<CPoint,CPoint> myArray;

// Add elements to the array.
for (int i = 0; i < 10; i++)
   myArray.Add(CPoint(i, 2 * i));

// Modify all the points in the array.
for (int i = 0; i < myArray.GetCount(); i++)
{
   CPoint& pt = myArray.ElementAt(i);
   pt.x = 0;
}

Requirements

Header: afxtempl.h

See Also

Reference

CArray Class

Hierarchy Chart

CArray::GetUpperBound

CArray::SetSize

CArray::GetSize

Other Resources

CArray Members