CodeNamespaceCollection クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class CodeNamespaceCollection Inherits CollectionBase
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class CodeNamespaceCollection : CollectionBase
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class CodeNamespaceCollection : public CollectionBase


' Creates an empty CodeNamespaceCollection. Dim collection As New CodeNamespaceCollection() ' Adds a CodeNamespace to the collection. collection.Add(New CodeNamespace("TestNamespace")) ' Adds an array of CodeNamespace objects to the collection. Dim namespaces As CodeNamespace() = {New CodeNamespace("TestNamespace1"), New CodeNamespace("TestNamespace2")} collection.AddRange(namespaces) ' Adds a collection of CodeNamespace objects to the collection. Dim namespacesCollection As New CodeNamespaceCollection() namespacesCollection.Add(New CodeNamespace("TestNamespace1")) namespacesCollection.Add(New CodeNamespace("TestNamespace2")) collection.AddRange(namespacesCollection) ' Tests for the presence of a CodeNamespace in the collection, ' and retrieves its index if it is found. Dim testNamespace As New CodeNamespace("TestNamespace") Dim itemIndex As Integer = -1 If collection.Contains(testNamespace) Then itemIndex = collection.IndexOf(testNamespace) End If ' Copies the contents of the collection beginning at index 0, ' to the specified CodeNamespace array. ' 'namespaces' is a CodeNamespace array. collection.CopyTo(namespaces, 0) ' Retrieves the count of the items in the collection. Dim collectionCount As Integer = collection.Count ' Inserts a CodeNamespace at index 0 of the collection. collection.Insert(0, New CodeNamespace("TestNamespace")) ' Removes the specified CodeNamespace from the collection. Dim namespace_ As New CodeNamespace("TestNamespace") collection.Remove(namespace_) ' Removes the CodeNamespace at index 0. collection.RemoveAt(0)
// Creates an empty CodeNamespaceCollection. CodeNamespaceCollection collection = new CodeNamespaceCollection(); // Adds a CodeNamespace to the collection. collection.Add( new CodeNamespace("TestNamespace") ); // Adds an array of CodeNamespace objects to the collection. CodeNamespace[] namespaces = { new CodeNamespace("TestNamespace1"), new CodeNamespace("TestNamespace2") }; collection.AddRange( namespaces ); // Adds a collection of CodeNamespace objects to the collection. CodeNamespaceCollection namespacesCollection = new CodeNamespaceCollection(); namespacesCollection.Add( new CodeNamespace("TestNamespace1") ); namespacesCollection.Add( new CodeNamespace("TestNamespace2") ); collection.AddRange( namespacesCollection ); // Tests for the presence of a CodeNamespace in the collection, // and retrieves its index if it is found. CodeNamespace testNamespace = new CodeNamespace("TestNamespace"); int itemIndex = -1; if( collection.Contains( testNamespace ) ) itemIndex = collection.IndexOf( testNamespace ); // Copies the contents of the collection beginning at index 0, // to the specified CodeNamespace array. // 'namespaces' is a CodeNamespace array. collection.CopyTo( namespaces, 0 ); // Retrieves the count of the items in the collection. int collectionCount = collection.Count; // Inserts a CodeNamespace at index 0 of the collection. collection.Insert( 0, new CodeNamespace("TestNamespace") ); // Removes the specified CodeNamespace from the collection. CodeNamespace namespace_ = new CodeNamespace("TestNamespace"); collection.Remove( namespace_ ); // Removes the CodeNamespace at index 0. collection.RemoveAt(0);
// Creates an empty CodeNamespaceCollection. CodeNamespaceCollection^ collection = gcnew CodeNamespaceCollection; // Adds a CodeNamespace to the collection. collection->Add( gcnew CodeNamespace( "TestNamespace" ) ); // Adds an array of CodeNamespace objects to the collection. array<CodeNamespace^>^namespaces = {gcnew CodeNamespace( "TestNamespace1" ),gcnew CodeNamespace( "TestNamespace2" )}; collection->AddRange( namespaces ); // Adds a collection of CodeNamespace objects to the collection. CodeNamespaceCollection^ namespacesCollection = gcnew CodeNamespaceCollection; namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace1" ) ); namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace2" ) ); collection->AddRange( namespacesCollection ); // Tests for the presence of a CodeNamespace in the collection, // and retrieves its index if it is found. CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" ); int itemIndex = -1; if ( collection->Contains( testNamespace ) ) itemIndex = collection->IndexOf( testNamespace ); // Copies the contents of the collection beginning at index 0, // to the specified CodeNamespace array. // 'namespaces' is a CodeNamespace array. collection->CopyTo( namespaces, 0 ); // Retrieves the count of the items in the collection. int collectionCount = collection->Count; // Inserts a CodeNamespace at index 0 of the collection. collection->Insert( 0, gcnew CodeNamespace( "TestNamespace" ) ); // Removes the specified CodeNamespace from the collection. CodeNamespace^ namespace_ = gcnew CodeNamespace( "TestNamespace" ); collection->Remove( namespace_ ); // Removes the CodeNamespace at index 0. collection->RemoveAt( 0 );
// Creates an empty CodeNamespaceCollection. CodeNamespaceCollection collection = new CodeNamespaceCollection(); // Adds a CodeNamespace to the collection. collection.Add(new CodeNamespace("TestNamespace")); // Adds an array of CodeNamespace objects to the collection. CodeNamespace namespaces[] = { new CodeNamespace("TestNamespace1"), new CodeNamespace("TestNamespace2") }; collection.AddRange(namespaces); // Adds a collection of CodeNamespace objects to the collection. CodeNamespaceCollection namespacesCollection = new CodeNamespaceCollection(); namespacesCollection.Add(new CodeNamespace("TestNamespace1")); namespacesCollection.Add(new CodeNamespace("TestNamespace2")); collection.AddRange(namespacesCollection); // Tests for the presence of a CodeNamespace in the collection, // and retrieves its index if it is found. CodeNamespace testNamespace = new CodeNamespace("TestNamespace"); int itemIndex = -1; if (collection.Contains(testNamespace)) { itemIndex = collection.IndexOf(testNamespace); } // Copies the contents of the collection beginning at index 0, // to the specified CodeNamespace array. // 'namespaces' is a CodeNamespace array. collection.CopyTo(namespaces, 0); // Retrieves the count of the items in the collection. int collectionCount = collection.get_Count(); // Inserts a CodeNamespace at index 0 of the collection. collection.Insert(0, new CodeNamespace("TestNamespace")); // Removes the specified CodeNamespace from the collection. CodeNamespace namespace_ = new CodeNamespace("TestNamespace"); collection.Remove(namespace_); // Removes the CodeNamespace at index 0. collection.RemoveAt(0);

System.Collections.CollectionBase
System.CodeDom.CodeNamespaceCollection


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- CodeNamespaceCollection クラスのページへのリンク