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

傳回

已加入 valueStringCollection 索引。

實作

例外狀況

StringCollection 為唯讀。

-或-

StringCollection 具有固定的大小。

備註

StringCollection 接受 null 做為有效值,並允許重複的專案。

如果 Count 已經等於容量,則會藉由自動重新配置內部數位來增加的 StringCollection 容量,而現有的元素會在新增專案之前複製到新的陣列。

如果 Count 小於容量,則這個方法是 O (1) 作業。 如果需要增加容量以容納新的元素,這個方法會變成 O () n 作業,其中 nCount

適用於

另請參閱