CodeNamespaceImportCollection Class
Represents a collection of CodeNamespaceImport objects.
For a list of all members of this type, see CodeNamespaceImportCollection Members.
System.Object
System.CodeDom.CodeNamespaceImportCollection
[Visual Basic] <Serializable> <ClassInterface(ClassInterfaceType.AutoDispatch)> <ComVisible(True)> Public Class CodeNamespaceImportCollection Implements IList, ICollection, IEnumerable [C#] [Serializable] [ClassInterface(ClassInterfaceType.AutoDispatch)] [ComVisible(true)] public class CodeNamespaceImportCollection : IList, ICollection, IEnumerable [C++] [Serializable] [ClassInterface(ClassInterfaceType::AutoDispatch)] [ComVisible(true)] public __gc class CodeNamespaceImportCollection : public IList, ICollection, IEnumerable [JScript] public Serializable ClassInterface(ClassInterfaceType.AutoDispatch) ComVisible(true) class CodeNamespaceImportCollection implements IList, ICollection, IEnumerable
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
The CodeNamespaceImportCollection class provides a simple collection object that can be used to store a set of CodeNamespaceImport objects.
Example
[Visual Basic] ' Creates an empty CodeNamespaceImportCollection. Dim collection As New CodeNamespaceImportCollection() ' Adds a CodeNamespaceImport to the collection. collection.Add(New CodeNamespaceImport("System")) ' Adds an array of CodeNamespaceImport objects to the collection. Dim [Imports] As CodeNamespaceImport() = _ {New CodeNamespaceImport("System"), _ New CodeNamespaceImport("System.Drawing")} collection.AddRange([Imports]) ' Retrieves the count of the items in the collection. Dim collectionCount As Integer = collection.Count [C#] // Creates an empty CodeNamespaceImportCollection. CodeNamespaceImportCollection collection = new CodeNamespaceImportCollection(); // Adds a CodeNamespaceImport to the collection. collection.Add( new CodeNamespaceImport("System") ); // Adds an array of CodeNamespaceImport objects to the collection. CodeNamespaceImport[] Imports = { new CodeNamespaceImport("System"), new CodeNamespaceImport("System.Drawing") }; collection.AddRange( Imports ); // Retrieves the count of the items in the collection. int collectionCount = collection.Count; [C++] // Creates an empty CodeNamespaceImportCollection. CodeNamespaceImportCollection* collection = new CodeNamespaceImportCollection(); // Adds a CodeNamespaceImport to the collection. collection->Add( new CodeNamespaceImport(S"System") ); // Adds an array of CodeNamespaceImport objects to the collection. CodeNamespaceImport* Imports[] = { new CodeNamespaceImport(S"System"), new CodeNamespaceImport(S"System.Drawing") }; collection->AddRange( Imports ); // Retrieves the count of the items in the collection. int collectionCount = collection->Count;
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.CodeDom
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)
See Also
CodeNamespaceImportCollection Members | System.CodeDom Namespace | CodeNamespaceImport