CodeTypeMemberCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
CodeTypeMember オブジェクトのコレクションを表します。
public ref class CodeTypeMemberCollection : System::Collections::CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeTypeMemberCollection : System.Collections.CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeTypeMemberCollection = class
inherit CollectionBase
Public Class CodeTypeMemberCollection
Inherits CollectionBase
- 継承
- 属性
例
次のコード例は、 CodeTypeMemberCollection クラスの使用方法を示しています。 この例では、クラスの新しいインスタンスを作成し、いくつかのメソッドを使用してコレクションにステートメントを追加し、そのインデックスを返し、特定のインデックス ポイントで属性を追加または削除します。
// Creates an empty CodeTypeMemberCollection.
CodeTypeMemberCollection collection = new CodeTypeMemberCollection();
// Adds a CodeTypeMember to the collection.
collection.Add( new CodeMemberField("System.String", "TestStringField") );
// Adds an array of CodeTypeMember objects to the collection.
CodeTypeMember[] members = { new CodeMemberField("System.String", "TestStringField1"), new CodeMemberField("System.String", "TestStringField2") };
collection.AddRange( members );
// Adds a collection of CodeTypeMember objects to the collection.
CodeTypeMemberCollection membersCollection = new CodeTypeMemberCollection();
membersCollection.Add( new CodeMemberField("System.String", "TestStringField1") );
membersCollection.Add( new CodeMemberField("System.String", "TestStringField2") );
collection.AddRange( membersCollection );
// Tests for the presence of a CodeTypeMember in the collection,
// and retrieves its index if it is found.
CodeTypeMember testMember = new CodeMemberField("System.String", "TestStringField");
int itemIndex = -1;
if( collection.Contains( testMember ) )
itemIndex = collection.IndexOf( testMember );
// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeMember array.
// 'members' is a CodeTypeMember array.
collection.CopyTo( members, 0 );
// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;
// Inserts a CodeTypeMember at index 0 of the collection.
collection.Insert( 0, new CodeMemberField("System.String", "TestStringField") );
// Removes the specified CodeTypeMember from the collection.
CodeTypeMember member = new CodeMemberField("System.String", "TestStringField");
collection.Remove( member );
// Removes the CodeTypeMember at index 0.
collection.RemoveAt(0);
' Creates an empty CodeTypeMemberCollection.
Dim collection As New CodeTypeMemberCollection()
' Adds a CodeTypeMember to the collection.
collection.Add(New CodeMemberField("System.String", "TestStringField"))
' Adds an array of CodeTypeMember objects to the collection.
Dim members As CodeTypeMember() = {New CodeMemberField("System.String", "TestStringField1"), New CodeMemberField("System.String", "TestStringField2")}
collection.AddRange(members)
' Adds a collection of CodeTypeMember objects to the collection.
Dim membersCollection As New CodeTypeMemberCollection()
membersCollection.Add(New CodeMemberField("System.String", "TestStringField1"))
membersCollection.Add(New CodeMemberField("System.String", "TestStringField2"))
collection.AddRange(membersCollection)
' Tests for the presence of a CodeTypeMember within the collection, and retrieves its index if it is within the collection.
Dim testMember = New CodeMemberField("System.String", "TestStringField")
Dim itemIndex As Integer = -1
If collection.Contains(testMember) Then
itemIndex = collection.IndexOf(testMember)
End If
' Copies the contents of the collection, beginning at index 0,
' to the specified CodeTypeMember array.
' 'members' is a CodeTypeMember array.
collection.CopyTo(members, 0)
' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count
' Inserts a CodeTypeMember at index 0 of the collection.
collection.Insert(0, New CodeMemberField("System.String", "TestStringField"))
' Removes the specified CodeTypeMember from the collection.
Dim member = New CodeMemberField("System.String", "TestStringField")
collection.Remove(member)
' Removes the CodeTypeMember at index 0.
collection.RemoveAt(0)
注釈
CodeTypeMemberCollection クラスは、一連のCodeTypeMember オブジェクトを格納するために使用できる単純なコレクション オブジェクトを提供します。
コンストラクター
| 名前 | 説明 |
|---|---|
| CodeTypeMemberCollection() |
CodeTypeMemberCollection クラスの新しいインスタンスを初期化します。 |
| CodeTypeMemberCollection(CodeTypeMember[]) |
オブジェクトの指定した配列を含む CodeTypeMemberCollection クラスの新しいインスタンス CodeTypeMember 初期化します。 |
| CodeTypeMemberCollection(CodeTypeMemberCollection) |
指定したソース コレクションの要素を含む CodeTypeMemberCollection クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Capacity |
CollectionBaseに含めることができる要素の数を取得または設定します。 (継承元 CollectionBase) |
| Count |
CollectionBase インスタンスに含まれる要素の数を取得します。 このプロパティはオーバーライドできません。 (継承元 CollectionBase) |
| InnerList |
ArrayList インスタンス内の要素の一覧を含むCollectionBaseを取得します。 (継承元 CollectionBase) |
| Item[Int32] |
コレクション内の指定したインデックス位置にある CodeTypeMember を取得または設定します。 |
| List |
IList インスタンス内の要素の一覧を含むCollectionBaseを取得します。 (継承元 CollectionBase) |
メソッド
明示的なインターフェイスの実装
| 名前 | 説明 |
|---|---|
| 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 の要素をフィルター処理します。 |