CodeNamespaceImportCollection CodeNamespaceImportCollection CodeNamespaceImportCollection CodeNamespaceImportCollection Class


表示 CodeNamespaceImport 对象集合。Represents a collection of CodeNamespaceImport objects.

public ref class CodeNamespaceImportCollection : System::Collections::IList
public class CodeNamespaceImportCollection : System.Collections.IList
type CodeNamespaceImportCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class CodeNamespaceImportCollection
Implements IList


下面的示例演示了CodeNamespaceImportCollection类的一些成员。The following example demonstrates some of the members of the CodeNamespaceImportCollection class. 该示例初始化类的新实例, 向其中添加CodeNamespaceImport对象, 并获取集合中对象的总数。The example initializes a new instance of the class, adds CodeNamespaceImport objects to it, and gets the total number of objects in the collection.

// Creates an empty CodeNamespaceImportCollection.
CodeNamespaceImportCollection^ collection =
   gcnew CodeNamespaceImportCollection;

// Adds a CodeNamespaceImport to the collection.
collection->Add( gcnew CodeNamespaceImport( "System" ) );

// Adds an array of CodeNamespaceImport objects to the collection.
array<CodeNamespaceImport^>^ Imports = {
   gcnew CodeNamespaceImport( "System" ),
   gcnew CodeNamespaceImport( "System.Drawing" )};
collection->AddRange( Imports );

// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;
// 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;
' 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")}

' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count


CodeNamespaceImportCollection 类提供一个简单的集合对象,该对象可用于存储一组 CodeNamespaceImport 对象。The CodeNamespaceImportCollection class provides a simple collection object that can be used to store a set of CodeNamespaceImport objects.


CodeNamespaceImportCollection() CodeNamespaceImportCollection() CodeNamespaceImportCollection() CodeNamespaceImportCollection()

初始化 CodeNamespaceImportCollection 类的新实例。Initializes a new instance of the CodeNamespaceImportCollection class.


Count Count Count Count

获取集合中命名空间的数目。Gets the number of namespaces in the collection.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取或设置集合中指定索引处的 CodeNamespaceImport 对象。Gets or sets the CodeNamespaceImport object at the specified index in the collection.


Add(CodeNamespaceImport) Add(CodeNamespaceImport) Add(CodeNamespaceImport) Add(CodeNamespaceImport)

CodeNamespaceImport 对象添加到集合中。Adds a CodeNamespaceImport object to the collection.

AddRange(CodeNamespaceImport[]) AddRange(CodeNamespaceImport[]) AddRange(CodeNamespaceImport[]) AddRange(CodeNamespaceImport[])

向集合添加一组 CodeNamespaceImport 对象。Adds a set of CodeNamespaceImport objects to the collection.

Clear() Clear() Clear() Clear()

清除成员集合。Clears the collection of members.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

获取枚举集合成员的枚举数。Gets an enumerator that enumerates the collection members.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)


ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

从特定的 ICollection 索引开始,将 Array 的元素复制到一个 Array 中。Copies the elements of the ICollection to an Array, starting at a particular Array index.

ICollection.Count ICollection.Count ICollection.Count ICollection.Count

获取 ICollection 中包含的元素数。Gets the number of elements contained in the ICollection.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

获取一个值,该值指示是否同步对 ICollection 的访问(线程安全)。Gets a value indicating whether access to the ICollection is synchronized (thread safe).

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

获取可用于同步对 ICollection 的访问的对象。Gets an object that can be used to synchronize access to the ICollection.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回可循环访问集合的枚举器。Returns an enumerator that can iterate through a collection.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

将对象添加到 IList 中。Adds an object to the IList.

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

IList 中移除所有项。Removes all items from the IList.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

确定 IList 是否包含特定值。Determines whether the IList contains a specific value.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

确定 IList 中特定项的索引。Determines the index of a specific item in the IList.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

IList 中的指定位置插入项。Inserts an item in the IList at the specified position.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

获取一个值,该值指示 IList 是否具有固定大小。Gets a value indicating whether the IList has a fixed size.

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

获取一个值,该值指示 IList 是否为只读。Gets a value indicating whether the IList is read-only.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

获取或设置指定索引处的元素。Gets or sets the element at the specified index.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

IList 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the IList.

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

移除 IList 的指定索引处的元素。Removes the element at the specified index of the IList.


Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.