CodeCommentStatementCollection 類別

定義

代表一組 CodeCommentStatement 物件。

public ref class CodeCommentStatementCollection : System::Collections::CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeCommentStatementCollection : System.Collections.CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeCommentStatementCollection = class
    inherit CollectionBase
Public Class CodeCommentStatementCollection
Inherits CollectionBase
繼承
CodeCommentStatementCollection
屬性

範例

以下範例展示了類別方法的使用 CodeCommentStatementCollection 。 範例會建立一個新的類別實例,並利用這些方法將語句加入集合、回傳其索引,以及在特定索引點新增或移除屬性。

// Creates an empty CodeCommentStatementCollection.
CodeCommentStatementCollection collection = new CodeCommentStatementCollection();

// Adds a CodeCommentStatement to the collection.
collection.Add( new CodeCommentStatement("Test comment") );

// Adds an array of CodeCommentStatement objects to the collection.
CodeCommentStatement[] comments = { new CodeCommentStatement("Test comment"), new CodeCommentStatement("Another test comment") };
collection.AddRange( comments );

// Adds a collection of CodeCommentStatement objects to the collection.
CodeCommentStatementCollection commentsCollection = new CodeCommentStatementCollection();
commentsCollection.Add( new CodeCommentStatement("Test comment") );
commentsCollection.Add( new CodeCommentStatement("Another test comment") );
collection.AddRange( commentsCollection );

// Tests for the presence of a CodeCommentStatement in the
// collection, and retrieves its index if it is found.
CodeCommentStatement testComment = new CodeCommentStatement("Test comment");
int itemIndex = -1;
if( collection.Contains( testComment ) )
    itemIndex = collection.IndexOf( testComment );

// Copies the contents of the collection, beginning at index 0,
// to the specified CodeCommentStatement array.
// 'comments' is a CodeCommentStatement array.
collection.CopyTo( comments, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;

// Inserts a CodeCommentStatement at index 0 of the collection.
collection.Insert( 0, new CodeCommentStatement("Test comment") );

// Removes the specified CodeCommentStatement from the collection.
CodeCommentStatement comment = new CodeCommentStatement("Test comment");
collection.Remove( comment );

// Removes the CodeCommentStatement at index 0.
collection.RemoveAt(0);
' Creates an empty CodeCommentStatementCollection.
Dim collection As New CodeCommentStatementCollection()

' Adds a CodeCommentStatement to the collection.
collection.Add(New CodeCommentStatement("Test comment"))

' Adds an array of CodeCommentStatement objects to the collection.
Dim comments As CodeCommentStatement() = {New CodeCommentStatement("Test comment"), New CodeCommentStatement("Another test comment")}
collection.AddRange(comments)

' Adds a collection of CodeCommentStatement objects to the 
' collection.
Dim commentsCollection As New CodeCommentStatementCollection()
commentsCollection.Add(New CodeCommentStatement("Test comment"))
commentsCollection.Add(New CodeCommentStatement("Another test comment"))
collection.AddRange(commentsCollection)

' Tests for the presence of a CodeCommentStatement in the 
' collection, and retrieves its index if it is found.
Dim testComment As New CodeCommentStatement("Test comment")
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
    itemIndex = collection.IndexOf(testComment)
End If

' Copies the contents of the collection beginning at index 0 to the specified CodeCommentStatement array.
' 'comments' is a CodeCommentStatement array.
collection.CopyTo(comments, 0)

' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count

' Inserts a CodeCommentStatement at index 0 of the collection.
collection.Insert(0, New CodeCommentStatement("Test comment"))

' Removes the specified CodeCommentStatement from the collection.
Dim comment As New CodeCommentStatement("Test comment")
collection.Remove(comment)

' Removes the CodeCommentStatement at index 0.
collection.RemoveAt(0)

備註

這個 CodeCommentStatementCollection 類別提供了一個簡單的集合物件,可以用來儲存一組 CodeCommentStatement 物件。

建構函式

名稱 Description
CodeCommentStatementCollection()

初始化 CodeCommentStatementCollection 類別的新執行個體。

CodeCommentStatementCollection(CodeCommentStatement[])

初始化包含指定物件陣列CodeCommentStatementCodeCommentStatementCollection類別新實例。

CodeCommentStatementCollection(CodeCommentStatementCollection)

初始化包含指定原始集合元素的類別新實例 CodeCommentStatementCollection

屬性

名稱 Description
Capacity

取得或設定 可以 CollectionBase 包含的元素數量。

(繼承來源 CollectionBase)
Count

取得該實例中包含 CollectionBase 的元素數量。 此屬性無法覆寫。

(繼承來源 CollectionBase)
InnerList

取得包含實ArrayList例中元素清單的 。CollectionBase

(繼承來源 CollectionBase)
Item[Int32]

取得或設定 CodeCommentStatement 物件在集合中指定的索引位置。

List

取得包含實IList例中元素清單的 。CollectionBase

(繼承來源 CollectionBase)

方法

名稱 Description
Add(CodeCommentStatement)

將指定的 CodeCommentStatement 物件加入集合中。

AddRange(CodeCommentStatement[])

將指定 CodeCommentStatement 陣列的元素複製到集合的末尾。

AddRange(CodeCommentStatementCollection)

將另一個 CodeCommentStatementCollection 物件的內容複製到集合的末尾。

Clear()

移除實例中 CollectionBase 的所有物件。 此方法無法被覆蓋。

(繼承來源 CollectionBase)
Contains(CodeCommentStatement)

會獲得一個值,表示該集合是否包含指定的 CodeCommentStatement 物件。

CopyTo(CodeCommentStatement[], Int32)

將集合物件從指定的索引起點複製到指定的一維 Array

Equals(Object)

判斷指定的 物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

回傳一個枚舉器,會遍歷該 CollectionBase 實例。

(繼承來源 CollectionBase)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type

(繼承來源 Object)
IndexOf(CodeCommentStatement)

取得集合中指定 CodeCommentStatement 物件的索引,前提是該物件存在於集合中。

Insert(Int32, CodeCommentStatement)

在指定的索引處插入物件 CodeCommentStatement

MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
OnClear()

在清除實例內容 CollectionBase 時執行額外的自訂程序。

(繼承來源 CollectionBase)
OnClearComplete()

清除實例內容 CollectionBase 後,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnInsert(Int32, Object)

在插入新元素前 CollectionBase ,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnInsertComplete(Int32, Object)

插入新元素後 CollectionBase 執行額外的自訂程序。

(繼承來源 CollectionBase)
OnRemove(Int32, Object)

移除實例中的 CollectionBase 元素時,會執行額外的自訂程序。

(繼承來源 CollectionBase)
OnRemoveComplete(Int32, Object)

移除實 CollectionBase 例元素後,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnSet(Int32, Object, Object)

在設定實例值 CollectionBase 前,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnSetComplete(Int32, Object, Object)

在實例設定值 CollectionBase 後,執行額外的自訂程序。

(繼承來源 CollectionBase)
OnValidate(Object)

在驗證值時執行額外的自訂流程。

(繼承來源 CollectionBase)
Remove(CodeCommentStatement)

從集合中移除指定的 CodeCommentStatement 物件。

RemoveAt(Int32)

移除實例指定索引 CollectionBase 的元素。 此方法無法被覆蓋。

(繼承來源 CollectionBase)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

明確介面實作

名稱 Description
ICollection.CopyTo(Array, Int32)

從目標陣列指定的索引開始,將整個 CollectionBase 複製到相容的一維 Array

(繼承來源 CollectionBase)
ICollection.IsSynchronized

取得值,指出是否同步存取 CollectionBase (線程安全)。

(繼承來源 CollectionBase)
ICollection.SyncRoot

取得一個物件,可用來同步存取 CollectionBase

(繼承來源 CollectionBase)
IList.Add(Object)

在 的末尾 CollectionBase加上一個物件。

(繼承來源 CollectionBase)
IList.Contains(Object)

判斷是否 CollectionBase 包含特定元素。

(繼承來源 CollectionBase)
IList.IndexOf(Object)

搜尋指定的 Object ,並返回整個 CollectionBase中首次出現的零基索引。

(繼承來源 CollectionBase)
IList.Insert(Int32, Object)

在指定的索引處插入一個元素 CollectionBase

(繼承來源 CollectionBase)
IList.IsFixedSize

會得到一個值,表示 是否 CollectionBase 具有固定大小。

(繼承來源 CollectionBase)
IList.IsReadOnly

取得值,指出 CollectionBase 是否為唯讀。

(繼承來源 CollectionBase)
IList.Item[Int32]

取得或設定位於指定索引處的專案。

(繼承來源 CollectionBase)
IList.Remove(Object)

移除特定物件 CollectionBase首次出現的 。

(繼承來源 CollectionBase)

擴充方法

名稱 Description
AsParallel(IEnumerable)

啟用查詢的平行處理。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別篩選 IEnumerable 的專案。

適用於

另請參閱