Compartilhar via


CArray::GetSize

Returns the size of the array.

INT_PTR GetSize( ) const;

Remarks

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::GetCount 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.GetSize(); i++)
{
   CPoint& pt = myArray.ElementAt(i);
   pt.x = 0;
}

Requirements

Header: afxtempl.h

See Also

Reference

CArray Class

Hierarchy Chart

CArray::GetUpperBound

CArray::GetCount