CodeNamespaceImportCollection 类

定义

表示 对象的集合 CodeNamespaceImport

public ref class CodeNamespaceImportCollection : System::Collections::IList
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeNamespaceImportCollection : System.Collections.IList
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeNamespaceImportCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class CodeNamespaceImportCollection
Implements IList
继承
CodeNamespaceImportCollection
属性
实现

示例

以下示例演示类的 CodeNamespaceImportCollection 一些成员。 该示例初始化类的新实例,将对象添加到 CodeNamespaceImport 其中,并获取集合中的对象总数。

// 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")}
collection.AddRange([Imports])

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

注解

CodeNamespaceImportCollection 类提供一个简单的集合对象,可用于存储一组 CodeNamespaceImport 对象。

构造函数

名称 说明
CodeNamespaceImportCollection()

初始化 CodeNamespaceImportCollection 类的新实例。

属性

名称 说明
Count

获取集合中的命名空间数。

Item[Int32]

获取或设置 CodeNamespaceImport 集合中指定索引处的对象。

方法

名称 说明
Add(CodeNamespaceImport)

将对象 CodeNamespaceImport 添加到集合。

AddRange(CodeNamespaceImport[])

将一组 CodeNamespaceImport 对象添加到集合。

Clear()

清除成员的集合。

Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetEnumerator()

获取枚举集合成员的枚举器。

GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

显式接口实现

名称 说明
ICollection.CopyTo(Array, Int32)

将元素ICollection复制到从特定Array索引开始的元素Array

ICollection.Count

获取包含在 . 中的 ICollection元素数。

ICollection.IsSynchronized

获取一个值,该值指示是否同步对 ICollection 的访问(线程安全)。

ICollection.SyncRoot

获取可用于同步对 . ICollection的访问的对象。

IEnumerable.GetEnumerator()

返回一个枚举器,该枚举器可以循环访问集合。

IList.Add(Object)

将对象添加到 .IList

IList.Clear()

IList.. 中删除所有项

IList.Contains(Object)

确定是否 IList 包含特定值。

IList.IndexOf(Object)

确定特定 IList项的索引。

IList.Insert(Int32, Object)

在指定位置插入项 IList

IList.IsFixedSize

获取一个值,该值指示是否 IList 具有固定大小。

IList.IsReadOnly

获取一个值,该值指示是否 IList 为只读。

IList.Item[Int32]

获取或设置指定索引处的元素。

IList.Remove(Object)

从中 IList删除特定对象的第一个匹配项。

IList.RemoveAt(Int32)

移除位于指定索引处的 IList元素。

扩展方法

名称 说明
AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

适用于

另请参阅