CodeDirectiveCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
CodeDirective オブジェクトのコレクションを表します。
public ref class CodeDirectiveCollection : System::Collections::CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeDirectiveCollection : System.Collections.CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeDirectiveCollection = class
inherit CollectionBase
Public Class CodeDirectiveCollection
Inherits CollectionBase
- 継承
- 属性
例
次のコード例は、 CodeDirectiveCollection クラスのメンバーの使用を示しています。
// Creates an empty CodeDirectiveCollection.
CodeDirectiveCollection collection = new CodeDirectiveCollection();
// Adds a CodeDirective to the collection.
collection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region1"));
// Adds an array of CodeDirective objects to the collection.
CodeDirective[] directives = {
new CodeRegionDirective(CodeRegionMode.Start,"Region1"),
new CodeRegionDirective(CodeRegionMode.End,"Region1") };
collection.AddRange(directives);
// Adds a collection of CodeDirective objects to the collection.
CodeDirectiveCollection directivesCollection = new CodeDirectiveCollection();
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region2"));
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.End, "Region2"));
collection.AddRange(directivesCollection);
// Tests for the presence of a CodeDirective in the
// collection, and retrieves its index if it is found.
CodeDirective testDirective = new CodeRegionDirective(CodeRegionMode.Start, "Region1");
int itemIndex = -1;
if (collection.Contains(testDirective))
itemIndex = collection.IndexOf(testDirective);
// Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
// 'directives' is a CodeDirective array.
collection.CopyTo(directives, 0);
// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;
// Inserts a CodeDirective at index 0 of the collection.
collection.Insert(0, new CodeRegionDirective(CodeRegionMode.Start, "Region1"));
// Removes the specified CodeDirective from the collection.
CodeDirective directive = new CodeRegionDirective(CodeRegionMode.Start, "Region1");
collection.Remove(directive);
// Removes the CodeDirective at index 0.
collection.RemoveAt(0);
' Creates an empty CodeDirectiveCollection.
Dim collection As New CodeDirectiveCollection()
' Adds a CodeDirective to the collection.
collection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region1"))
' Adds an array of CodeDirective objects to the collection.
Dim directives As CodeDirective() = {New CodeRegionDirective(CodeRegionMode.Start, "Region1"), New CodeRegionDirective(CodeRegionMode.End, "Region1")}
collection.AddRange(directives)
' Adds a collection of CodeDirective objects to the collection.
Dim directivesCollection As New CodeDirectiveCollection()
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region2"))
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.End, "Region2"))
collection.AddRange(directivesCollection)
' Tests for the presence of a CodeDirective in the
' collection, and retrieves its index if it is found.
Dim testDirective = New CodeRegionDirective(CodeRegionMode.Start, "Region1")
Dim itemIndex As Integer = -1
If collection.Contains(testDirective) Then
itemIndex = collection.IndexOf(testDirective)
End If
' Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
' 'directives' is a CodeDirective array.
collection.CopyTo(directives, 0)
' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count
' Inserts a CodeDirective at index 0 of the collection.
collection.Insert(0, New CodeRegionDirective(CodeRegionMode.Start, "Region1"))
' Removes the specified CodeDirective from the collection.
Dim directive = New CodeRegionDirective(CodeRegionMode.Start, "Region1")
collection.Remove(directive)
' Removes the CodeDirective at index 0.
collection.RemoveAt(0)
End Sub
End Class
注釈
CodeDirectiveCollection クラスは、一連のCodeDirective オブジェクトを格納するために使用できる単純なコレクション オブジェクトを提供します。
コンストラクター
| 名前 | 説明 |
|---|---|
| CodeDirectiveCollection() |
CodeDirectiveCollection クラスの新しいインスタンスを初期化します。 |
| CodeDirectiveCollection(CodeDirective[]) |
指定した配列内のコード ディレクティブ オブジェクトを使用して、 CodeDirectiveCollection クラスの新しいインスタンスを初期化します。 |
| CodeDirectiveCollection(CodeDirectiveCollection) |
指定したコード ディレクティブ コレクション内の要素を使用して、 CodeDirectiveCollection クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Capacity |
CollectionBaseに含めることができる要素の数を取得または設定します。 (継承元 CollectionBase) |
| Count |
CollectionBase インスタンスに含まれる要素の数を取得します。 このプロパティはオーバーライドできません。 (継承元 CollectionBase) |
| InnerList |
ArrayList インスタンス内の要素の一覧を含むCollectionBaseを取得します。 (継承元 CollectionBase) |
| Item[Int32] |
コレクション内の指定したインデックス位置にある CodeDirective オブジェクトを取得または設定します。 |
| List |
IList インスタンス内の要素の一覧を含むCollectionBaseを取得します。 (継承元 CollectionBase) |
メソッド
| 名前 | 説明 |
|---|---|
| Add(CodeDirective) |
指定した CodeDirective オブジェクトをコレクションに追加します。 |
| AddRange(CodeDirective[]) |
CodeDirective オブジェクトの配列をコレクションの末尾に追加します。 |
| AddRange(CodeDirectiveCollection) |
指定した CodeDirectiveCollection オブジェクトの内容をコレクションの末尾に追加します。 |
| Clear() |
CollectionBase インスタンスからすべてのオブジェクトを削除します。 このメソッドはオーバーライドできません。 (継承元 CollectionBase) |
| Contains(CodeDirective) |
指定した CodeDirective オブジェクトがコレクションに含まれているかどうかを示す値を取得します。 |
| CopyTo(CodeDirective[], Int32) |
コレクションの内容を、指定したインデックスから始まる 1 次元配列にコピーします。 |
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetEnumerator() |
CollectionBase インスタンスを反復処理する列挙子を返します。 (継承元 CollectionBase) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IndexOf(CodeDirective) |
指定した CodeDirective オブジェクトのコレクション内のインデックスがコレクション内に存在する場合は、そのインデックスを取得します。 |
| Insert(Int32, CodeDirective) |
指定した CodeDirective オブジェクトをコレクション内の指定したインデックス位置に挿入します。 |
| 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(CodeDirective) |
指定した CodeDirective オブジェクトをコレクションから削除します。 |
| RemoveAt(Int32) |
CollectionBase インスタンスの指定したインデックス位置にある要素を削除します。 このメソッドはオーバーライドできません。 (継承元 CollectionBase) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| 名前 | 説明 |
|---|---|
| ICollection.CopyTo(Array, Int32) |
ターゲット配列の指定したインデックスから始まる互換性のある 1 次元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全体で最初に見つかった位置の 0 から始まるインデックスを返します。 (継承元 CollectionBase) |
| IList.Insert(Int32, Object) |
指定したインデックス位置にある CollectionBase に要素を挿入します。 (継承元 CollectionBase) |
| IList.IsFixedSize |
CollectionBaseに固定サイズがあるかどうかを示す値を取得します。 (継承元 CollectionBase) |
| IList.IsReadOnly |
CollectionBaseが読み取り専用かどうかを示す値を取得します。 (継承元 CollectionBase) |
| IList.Item[Int32] |
指定したインデックス位置にある要素を取得または設定します。 (継承元 CollectionBase) |
| IList.Remove(Object) |
特定のオブジェクトの最初の出現箇所を CollectionBaseから削除します。 (継承元 CollectionBase) |
拡張メソッド
| 名前 | 説明 |
|---|---|
| AsParallel(IEnumerable) |
クエリの並列化を有効にします。 |
| AsQueryable(IEnumerable) |
IEnumerable を IQueryableに変換します。 |
| Cast<TResult>(IEnumerable) |
IEnumerable の要素を指定した型にキャストします。 |
| OfType<TResult>(IEnumerable) |
指定した型に基づいて、IEnumerable の要素をフィルター処理します。 |