CodeTypeReference オブジェクトのコレクションを表します。
この型のすべてのメンバの一覧については、CodeTypeReferenceCollection メンバ を参照してください。
System.Object
System.Collections.CollectionBase
System.CodeDom.CodeTypeReferenceCollection
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeTypeReferenceCollection Inherits CollectionBase
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeTypeReferenceCollection : CollectionBase
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeTypeReferenceCollection : public CollectionBase
[JScript]
public
Serializable
ClassInterface(ClassInterfaceType.AutoDispatch)
ComVisible(true)
class CodeTypeReferenceCollection extends CollectionBase
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
解説
CodeTypeReferenceCollection クラスは、 CodeTypeReference オブジェクトのセットを格納するために使用できる単純なコレクション オブジェクトを提供します。
使用例
' Creates an empty CodeTypeReferenceCollection.
Dim collection As New CodeTypeReferenceCollection()
' Adds a CodeTypeReference to the collection.
collection.Add(New CodeTypeReference(GetType(Boolean)))
' Adds an array of CodeTypeReference objects to the collection.
Dim references As CodeTypeReference() = {New CodeTypeReference(GetType(Boolean)), New CodeTypeReference(GetType(Boolean))}
collection.AddRange(references)
' Adds a collection of CodeTypeReference objects to the collection.
Dim referencesCollection As New CodeTypeReferenceCollection()
referencesCollection.Add(New CodeTypeReference(GetType(Boolean)))
referencesCollection.Add(New CodeTypeReference(GetType(Boolean)))
collection.AddRange(referencesCollection)
' Tests for the presence of a CodeTypeReference in the
' collection, and retrieves its index if it is found.
Dim testReference As New CodeTypeReference(GetType(Boolean))
Dim itemIndex As Integer = -1
If collection.Contains(testReference) Then
itemIndex = collection.IndexOf(testReference)
End If
' Copies the contents of the collection, beginning at index 0,
' to the specified CodeTypeReference array.
' 'references' is a CodeTypeReference array.
collection.CopyTo(references, 0)
' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count
' Inserts a CodeTypeReference at index 0 of the collection.
collection.Insert(0, New CodeTypeReference(GetType(Boolean)))
' Removes the specified CodeTypeReference from the collection.
Dim reference As New CodeTypeReference(GetType(Boolean))
collection.Remove(reference)
' Removes the CodeTypeReference at index 0.
collection.RemoveAt(0)
[C#]
// Creates an empty CodeTypeReferenceCollection.
CodeTypeReferenceCollection collection = new CodeTypeReferenceCollection();
// Adds a CodeTypeReference to the collection.
collection.Add( new CodeTypeReference(typeof(bool)) );
// Adds an array of CodeTypeReference objects to the collection.
CodeTypeReference[] references = { new CodeTypeReference(typeof(bool)), new CodeTypeReference(typeof(bool)) };
collection.AddRange( references );
// Adds a collection of CodeTypeReference objects to the collection.
CodeTypeReferenceCollection referencesCollection = new CodeTypeReferenceCollection();
referencesCollection.Add( new CodeTypeReference(typeof(bool)) );
referencesCollection.Add( new CodeTypeReference(typeof(bool)) );
collection.AddRange( referencesCollection );
// Tests for the presence of a CodeTypeReference in the
// collection, and retrieves its index if it is found.
CodeTypeReference testReference = new CodeTypeReference(typeof(bool));
int itemIndex = -1;
if( collection.Contains( testReference ) )
itemIndex = collection.IndexOf( testReference );
// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeReference array.
// 'references' is a CodeTypeReference array.
collection.CopyTo( references, 0 );
// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;
// Inserts a CodeTypeReference at index 0 of the collection.
collection.Insert( 0, new CodeTypeReference(typeof(bool)) );
// Removes the specified CodeTypeReference from the collection.
CodeTypeReference reference = new CodeTypeReference(typeof(bool));
collection.Remove( reference );
// Removes the CodeTypeReference at index 0.
collection.RemoveAt(0);
[C++]
// Creates an empty CodeTypeReferenceCollection.
CodeTypeReferenceCollection* collection = new CodeTypeReferenceCollection();
// Adds a CodeTypeReference to the collection.
collection->Add( new CodeTypeReference(__typeof(bool)) );
// Adds an array of CodeTypeReference objects to the collection.
CodeTypeReference* references[] = { new CodeTypeReference(__typeof(bool)), new CodeTypeReference(__typeof(bool)) };
collection->AddRange( references );
// Adds a collection of CodeTypeReference objects to the collection.
CodeTypeReferenceCollection* referencesCollection = new CodeTypeReferenceCollection();
referencesCollection->Add( new CodeTypeReference(__typeof(bool)) );
referencesCollection->Add( new CodeTypeReference(__typeof(bool)) );
collection->AddRange( referencesCollection );
// Tests for the presence of a CodeTypeReference in the
// collection, and retrieves its index if it is found.
CodeTypeReference* testReference = new CodeTypeReference(__typeof(bool));
int itemIndex = -1;
if( collection->Contains( testReference ) )
itemIndex = collection->IndexOf( testReference );
// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeReference array.
// 'references' is a CodeTypeReference array.
collection->CopyTo( references, 0 );
// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;
// Inserts a CodeTypeReference at index 0 of the collection.
collection->Insert( 0, new CodeTypeReference(__typeof(bool)) );
// Removes the specified CodeTypeReference from the collection.
CodeTypeReference* reference = new CodeTypeReference(__typeof(bool));
collection->Remove( reference );
// Removes the CodeTypeReference at index 0.
collection->RemoveAt(0);
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.CodeDom
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: System (System.dll 内)
参照
CodeTypeReferenceCollection メンバ | System.CodeDom 名前空間 | CodeTypeReference