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