返回数组元素的数目。
INT_PTR GetCount( ) const;
返回值
项的数目数组中。
备注
调用此方法检索元素数。数组的。因为索引是从零开始,数组大小大于最大的索引为1。调用此方法将生成结果和 CArray::GetSize 方法相同。
示例
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;
}
要求
Header: afxtempl.h