語言

StringCollection.IList.Add(Object) 方法

定義

將物件加入至 StringCollection的結尾。

 virtual int System.Collections.IList.Add(System::Object ^ value) = System::Collections::IList::Add;
int IList.Add(object value);
int IList.Add(object? value);
abstract member System.Collections.IList.Add : obj -> int
override this.System.Collections.IList.Add : obj -> int
Function Add (value As Object) As Integer Implements IList.Add

參數

value
Object

Object將 加入 StringCollection。 其值可以是 null。

傳回

StringCollection該指數被加入的索引value。

實作

例外狀況

這是 StringCollection 唯讀的。

-或-

它 StringCollection 有固定尺寸。

備註

StringCollection 接受 null 為有效值,並允許重複元素。

如果 Count 已經等於容量, StringCollection 則會自動重新配置內部陣列,並先複製現有元素到新陣列,然後再加入新元素。

若 Count 小於容量,此方法為 O(1) 操作。 若需增加容量以容納新元素,此方法將成為 O(n) 運算,其中 n 為 Count。

適用於

另請參閱