Stack.Count 屬性

定義

得到包含於 的 Stack元素數量。

public:
 virtual property int Count { int get(); };
public virtual int Count { get; }
member this.Count : int
Public Overridable ReadOnly Property Count As Integer

屬性值

包含於 Stack的元素數量。

實作

備註

容量是指可 Stack 儲存的元件數量。 Count 是實際屬於 的 Stack元素數量。

容量總是大於或等 Count於。 若 Count 在新增元件時超過容量,則會自動透過重新配置內部陣列來增加容量,然後再複製舊元素並加入新元素。

取得該屬性的價值是一個 O(1) 操作。

適用於