BindingList<T> BindingList<T> BindingList<T> BindingList<T> Class

定义

提供支持数据绑定的泛型集合。Provides a generic collection that supports data binding.

generic <typename T>
public ref class BindingList : System::Collections::ObjectModel::Collection<T>, System::ComponentModel::IBindingList, System::ComponentModel::ICancelAddNew, System::ComponentModel::IRaiseItemChangedEvents
[System.Serializable]
public class BindingList<T> : System.Collections.ObjectModel.Collection<T>, System.ComponentModel.IBindingList, System.ComponentModel.ICancelAddNew, System.ComponentModel.IRaiseItemChangedEvents
type BindingList<'T> = class
    inherit Collection<'T>
    interface IBindingList
    interface ICancelAddNew
    interface IRaiseItemChangedEvents
    interface IList
    interface ICollection
    interface IEnumerable
Public Class BindingList(Of T)
Inherits Collection(Of T)
Implements IBindingList, ICancelAddNew, IRaiseItemChangedEvents

类型参数

T

列表中元素的类型。The type of elements in the list.

继承
BindingList<T>BindingList<T>BindingList<T>BindingList<T>
属性
实现

示例

下面的代码示例演示如何绑定到BindingList<T>包含业务对象的组件。The following code example demonstrates binding to a BindingList<T> component containing a business object. 这是一个包含Main方法的完整示例。This is a complete example that contains a Main method.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BindingListOfTExamples
{
    public partial class Form1 : Form
    {
        private TextBox textBox2;
        private ListBox listBox1;
        private Button button1;
        private TextBox textBox1;
        Random randomNumber = new Random();
    
        public Form1()
        {
           this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
           this.textBox1 = new System.Windows.Forms.TextBox();
           this.textBox2 = new System.Windows.Forms.TextBox();
           this.listBox1 = new System.Windows.Forms.ListBox();
           this.button1 = new System.Windows.Forms.Button();
           this.textBox1.Location = new System.Drawing.Point(169, 26);
           this.textBox1.Size = new System.Drawing.Size(100, 20);
           this.textBox1.Text = "Bracket";
           this.textBox2.Location = new System.Drawing.Point(169, 57);
           this.textBox2.ReadOnly = true;
           this.textBox2.Size = new System.Drawing.Size(100, 20);
           this.textBox2.Text = "4343";
           this.listBox1.FormattingEnabled = true;
           this.listBox1.Location = new System.Drawing.Point(12, 12);
           this.listBox1.Size = new System.Drawing.Size(120, 95);
           this.button1.Location = new System.Drawing.Point(180, 83);
           this.button1.Size = new System.Drawing.Size(75, 23);
           this.button1.Text = "Add New Item";
           this.button1.Click += new System.EventHandler(this.button1_Click);
           this.ClientSize = new System.Drawing.Size(292, 266);
           this.Controls.Add(this.button1);
           this.Controls.Add(this.listBox1);
           this.Controls.Add(this.textBox2);
           this.Controls.Add(this.textBox1);
           this.Text = "Parts Form";
           this.Load += new EventHandler(Form1_Load);
          
        }
    
        void Form1_Load(object sender, EventArgs e)
        {
            InitializeListOfParts();
            listBox1.DataSource = listOfParts;
            listBox1.DisplayMember = "PartName";
            listOfParts.AddingNew += new AddingNewEventHandler(listOfParts_AddingNew);
            listOfParts.ListChanged += new ListChangedEventHandler(listOfParts_ListChanged);
            
        }

       

        // Declare a new BindingListOfT with the Part business object.
        BindingList<Part> listOfParts; 
        private void InitializeListOfParts()
        {
            // Create the new BindingList of Part type.
            listOfParts = new BindingList<Part>();
    
            // Allow new parts to be added, but not removed once committed.        
            listOfParts.AllowNew = true;
            listOfParts.AllowRemove = false;

            // Raise ListChanged events when new parts are added.
            listOfParts.RaiseListChangedEvents = true;

            // Do not allow parts to be edited.
            listOfParts.AllowEdit = false;
            
            // Add a couple of parts to the list.
            listOfParts.Add(new Part("Widget", 1234));
            listOfParts.Add(new Part("Gadget", 5647));
        }

        
        // Create a new part from the text in the two text boxes.
        void listOfParts_AddingNew(object sender, AddingNewEventArgs e)
        {
            e.NewObject = new Part(textBox1.Text, int.Parse(textBox2.Text));
            
        }

        
        // Add the new part unless the part number contains
        // spaces. In that case cancel the add.
        private void button1_Click(object sender, EventArgs e)
        {
            Part newPart = listOfParts.AddNew();

            if (newPart.PartName.Contains(" "))
            {
                MessageBox.Show("Part names cannot contain spaces.");
                listOfParts.CancelNew(listOfParts.IndexOf(newPart));
            }
            else
            {
                textBox2.Text = randomNumber.Next(9999).ToString();
                textBox1.Text = "Enter part name";
            }
        }

        void listOfParts_ListChanged(object sender, ListChangedEventArgs e)
        {
            MessageBox.Show(e.ListChangedType.ToString());
        }

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

    }
    
    // A simple business object for example purposes.
    public class Part
    {
        private string name;
        private int number;
        public Part() { }
        public Part(string nameForPart, int numberForPart)
        {
            PartName = nameForPart;
            PartNumber = numberForPart;
        }

        public string PartName
        {
            get { return name; }
            set { name = value; }
        }

        public int PartNumber
        {
            get { return number; }
            set { number = value; }
        }
    }
}

Option Explicit On
Option Strict On
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms

Class Form1
    Inherits Form

    Private textBox2 As TextBox
    Private listBox1 As ListBox
    Private WithEvents button1 As Button
    Private textBox1 As TextBox
    Private randomNumber As New Random()

    Public Sub New()
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.textBox1 = New System.Windows.Forms.TextBox()
        Me.textBox2 = New System.Windows.Forms.TextBox()
        Me.listBox1 = New System.Windows.Forms.ListBox()
        Me.button1 = New System.Windows.Forms.Button()
        Me.textBox1.Location = New System.Drawing.Point(169, 26)
        Me.textBox1.Size = New System.Drawing.Size(100, 20)
        Me.textBox1.Text = "Bracket"
        Me.textBox2.Location = New System.Drawing.Point(169, 57)
        Me.textBox2.ReadOnly = True
        Me.textBox2.Size = New System.Drawing.Size(100, 20)
        Me.textBox2.Text = "4343"
        Me.listBox1.FormattingEnabled = True
        Me.listBox1.Location = New System.Drawing.Point(12, 12)
        Me.listBox1.Size = New System.Drawing.Size(120, 95)
        Me.button1.Location = New System.Drawing.Point(180, 83)
        Me.button1.Size = New System.Drawing.Size(75, 23)
        Me.button1.Text = "Add New Item"
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.Add(Me.button1)
        Me.Controls.Add(Me.listBox1)
        Me.Controls.Add(Me.textBox2)
        Me.Controls.Add(Me.textBox1)
        Me.Text = "Parts Form"
        AddHandler Me.Load, AddressOf Form1_Load

    End Sub 'New

    Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        InitializeListOfParts()
        listBox1.DataSource = listOfParts
        listBox1.DisplayMember = "PartName"
    End Sub

    ' Declare a new BindingListOfT with the Part business object.
    Private WithEvents listOfParts As BindingList(Of Part)

    Private Sub InitializeListOfParts()

        ' Create the new BindingList of Part type.
        listOfParts = New BindingList(Of Part)

        ' Allow new parts to be added, but not removed once committed.        
        listOfParts.AllowNew = True
        listOfParts.AllowRemove = False

        ' Raise ListChanged events when new parts are added.
        listOfParts.RaiseListChangedEvents = True

        ' Do not allow parts to be edited.
        listOfParts.AllowEdit = False

        ' Add a couple of parts to the list.
        listOfParts.Add(New Part("Widget", 1234))
        listOfParts.Add(New Part("Gadget", 5647))

    End Sub

    ' Create a new part from the text in the two text boxes.
    Private Sub listOfParts_AddingNew(ByVal sender As Object, _
        ByVal e As AddingNewEventArgs) Handles listOfParts.AddingNew
        e.NewObject = New Part(textBox1.Text, Integer.Parse(textBox2.Text))

    End Sub


    ' Add the new part unless the part number contains
    ' spaces. In that case cancel the add.
    Private Sub button1_Click(ByVal sender As Object, _
        ByVal e As EventArgs) Handles button1.Click

        Dim newPart As Part = listOfParts.AddNew()

        If newPart.PartName.Contains(" ") Then
            MessageBox.Show("Part names cannot contain spaces.")
            listOfParts.CancelNew(listOfParts.IndexOf(newPart))
        Else
            textBox2.Text = randomNumber.Next(9999).ToString()
            textBox1.Text = "Enter part name"
        End If

    End Sub

    <STAThread()> _
    Shared Sub Main()
        Application.EnableVisualStyles()
        Application.Run(New Form1())

    End Sub
End Class

' A simple business object for example purposes.
Public Class Part
    Private name As String
    Private number As Integer

    Public Sub New()
    End Sub

    Public Sub New(ByVal nameForPart As String, _
        ByVal numberForPart As Integer)
        PartName = nameForPart
        PartNumber = numberForPart

    End Sub


    Public Property PartName() As String
        Get
            Return name
        End Get
        Set(ByVal value As String)
            name = Value
        End Set
    End Property

    Public Property PartNumber() As Integer
        Get
            Return number
        End Get
        Set(ByVal value As Integer)
            number = Value
        End Set
    End Property
End Class

注解

BindingList<T>类可用作基类, 以创建双向数据绑定机制。The BindingList<T> class can be used as a base class to create a two-way data-binding mechanism. BindingList<T>提供IBindingList接口的具体泛型实现。BindingList<T> provides a concrete, generic implementation of the IBindingList interface. 这是IBindingList实现完整接口的一种替代方法, 这可能很难, 因为、 IEditableObject与关联IBindingList CurrencyManager的之间有微妙的交互。This is an alternative to implementing the complete IBindingList interface, which can be difficult because of the subtle interaction between IBindingList, IEditableObject, and the associated CurrencyManager. 但是, 典型的解决方案程序员将使用一个提供数据绑定功能的类, 如BindingSource, 而不是直接使用。 BindingList<T>However, the typical solutions programmer will use a class that provides data binding functionality, such as BindingSource, instead of directly using BindingList<T>.

BindingList<T>通过可扩展AddNew方法支持工厂创建的实例。BindingList<T> supports factory-created instances through the extensible AddNew method. (此外, 在其他类 (如BindingSource) 中也可以找到此类型的可扩展性, 因为此类ICancelAddNew实现接口, 因此它通过EndNewCancelNew实现了新项的事务提交或回滚。方法。(This same type of extensibility is also found in other classes, such as BindingSource) In addition, since this class implements the ICancelAddNew interface, it enables transactional commits or rollbacks of the new item through the EndNew and CancelNew methods.

构造函数

BindingList<T>() BindingList<T>() BindingList<T>() BindingList<T>()

使用默认值初始化 BindingList<T> 类的新实例。Initializes a new instance of the BindingList<T> class using default values.

BindingList<T>(IList<T>) BindingList<T>(IList<T>) BindingList<T>(IList<T>) BindingList<T>(IList<T>)

使用指定列表初始化 BindingList<T> 类的新实例。Initializes a new instance of the BindingList<T> class with the specified list.

属性

AllowEdit AllowEdit AllowEdit AllowEdit

获取或设置一个值,该值指示该列表中的项是否可以编辑。Gets or sets a value indicating whether items in the list can be edited.

AllowNew AllowNew AllowNew AllowNew

获取或设置一个值,该值指示是否可以使用 AddNew() 方法向列表中添加项。Gets or sets a value indicating whether you can add items to the list using the AddNew() method.

AllowRemove AllowRemove AllowRemove AllowRemove

获取或设置一个值,该值指示是否可以从集合中移除项。Gets or sets a value indicating whether you can remove items from the collection.

Count Count Count Count

获取 Collection<T> 中实际包含的元素数。Gets the number of elements actually contained in the Collection<T>.

(Inherited from Collection<T>)
ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

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

(Inherited from Collection<T>)
ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

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

(Inherited from Collection<T>)
ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly

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

(Inherited from Collection<T>)
IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

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

(Inherited from Collection<T>)
IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

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

(Inherited from Collection<T>)
IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

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

(Inherited from Collection<T>)
IsSortedCore IsSortedCore IsSortedCore IsSortedCore

获取一个值,指示列表是否已排序。Gets a value indicating whether the list is sorted.

Items Items Items Items

获取 IList<T> 周围的 Collection<T> 包装。Gets a IList<T> wrapper around the Collection<T>.

(Inherited from Collection<T>)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

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

(Inherited from Collection<T>)
RaiseListChangedEvents RaiseListChangedEvents RaiseListChangedEvents RaiseListChangedEvents

获取或设置一个值,该值指示在列表中添加或移除项时是否会引发 ListChanged 事件。Gets or sets a value indicating whether adding or removing items within the list raises ListChanged events.

SortDirectionCore SortDirectionCore SortDirectionCore SortDirectionCore

获取列表的排序方向。Gets the direction the list is sorted.

SortPropertyCore SortPropertyCore SortPropertyCore SortPropertyCore

如果在派生类中实现了排序,则获取用于对列表排序的属性说明符;否则返回 nullGets the property descriptor that is used for sorting the list if sorting is implemented in a derived class; otherwise, returns null.

SupportsChangeNotificationCore SupportsChangeNotificationCore SupportsChangeNotificationCore SupportsChangeNotificationCore

获取一个值,该值指示是否启用 ListChanged 事件。Gets a value indicating whether ListChanged events are enabled.

SupportsSearchingCore SupportsSearchingCore SupportsSearchingCore SupportsSearchingCore

获取一个值,该值指示列表是否支持搜索。Gets a value indicating whether the list supports searching.

SupportsSortingCore SupportsSortingCore SupportsSortingCore SupportsSortingCore

获取一个值,该值指示列表是否支持排序。Gets a value indicating whether the list supports sorting.

方法

Add(T) Add(T) Add(T) Add(T)

将对象添加到 Collection<T> 的结尾处。Adds an object to the end of the Collection<T>.

(Inherited from Collection<T>)
AddNew() AddNew() AddNew() AddNew()

将新项添加到集合中。Adds a new item to the collection.

AddNewCore() AddNewCore() AddNewCore() AddNewCore()

将新项添加到集合末尾。Adds a new item to the end of the collection.

ApplySortCore(PropertyDescriptor, ListSortDirection) ApplySortCore(PropertyDescriptor, ListSortDirection) ApplySortCore(PropertyDescriptor, ListSortDirection) ApplySortCore(PropertyDescriptor, ListSortDirection)

如果已在派生类中重写,则对项进行排序;否则将引发 NotSupportedExceptionSorts the items if overridden in a derived class; otherwise, throws a NotSupportedException.

CancelNew(Int32) CancelNew(Int32) CancelNew(Int32) CancelNew(Int32)

丢弃挂起的新项。Discards a pending new item.

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

Collection<T> 中移除所有元素。Removes all elements from the Collection<T>.

(Inherited from Collection<T>)
ClearItems() ClearItems() ClearItems() ClearItems()

移除集合中的所有元素。Removes all elements from the collection.

Contains(T) Contains(T) Contains(T) Contains(T)

确定某元素是否在 Collection<T> 中。Determines whether an element is in the Collection<T>.

(Inherited from Collection<T>)
CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32)

从目标数组的指定索引处开始将整个 Collection<T> 复制到兼容的一维 ArrayCopies the entire Collection<T> to a compatible one-dimensional Array, starting at the specified index of the target array.

(Inherited from Collection<T>)
EndNew(Int32) EndNew(Int32) EndNew(Int32) EndNew(Int32)

向集合提交挂起的新项。Commits a pending new item to the collection.

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

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

(Inherited from Object)
FindCore(PropertyDescriptor, Object) FindCore(PropertyDescriptor, Object) FindCore(PropertyDescriptor, Object) FindCore(PropertyDescriptor, Object)

如果在派生类中实现了搜索,则用指定值搜索具有指定属性说明符的项的索引;否则将引发 NotSupportedExceptionSearches for the index of the item that has the specified property descriptor with the specified value, if searching is implemented in a derived class; otherwise, a NotSupportedException.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回循环访问 Collection<T> 的枚举数。Returns an enumerator that iterates through the Collection<T>.

(Inherited from Collection<T>)
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)
IndexOf(T) IndexOf(T) IndexOf(T) IndexOf(T)

搜索指定的对象,并返回整个 Collection<T> 中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the entire Collection<T>.

(Inherited from Collection<T>)
Insert(Int32, T) Insert(Int32, T) Insert(Int32, T) Insert(Int32, T)

将元素插入 Collection<T> 的指定索引处。Inserts an element into the Collection<T> at the specified index.

(Inherited from Collection<T>)
InsertItem(Int32, T) InsertItem(Int32, T) InsertItem(Int32, T) InsertItem(Int32, T)

将指定的项插入到列表中的指定索引位置。Inserts the specified item in the list at the specified index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
OnAddingNew(AddingNewEventArgs) OnAddingNew(AddingNewEventArgs) OnAddingNew(AddingNewEventArgs) OnAddingNew(AddingNewEventArgs)

引发 AddingNew 事件。Raises the AddingNew event.

OnListChanged(ListChangedEventArgs) OnListChanged(ListChangedEventArgs) OnListChanged(ListChangedEventArgs) OnListChanged(ListChangedEventArgs)

引发 ListChanged 事件。Raises the ListChanged event.

Remove(T) Remove(T) Remove(T) Remove(T)

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

(Inherited from Collection<T>)
RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

移除 Collection<T> 的指定索引处的元素。Removes the element at the specified index of the Collection<T>.

(Inherited from Collection<T>)
RemoveItem(Int32) RemoveItem(Int32) RemoveItem(Int32) RemoveItem(Int32)

移除指定索引处的项。Removes the item at the specified index.

RemoveSortCore() RemoveSortCore() RemoveSortCore() RemoveSortCore()

如果在派生类中实现排序,则移除通过 ApplySortCore(PropertyDescriptor, ListSortDirection) 应用的任何排序;否则将引发 NotSupportedExceptionRemoves any sort applied with ApplySortCore(PropertyDescriptor, ListSortDirection) if sorting is implemented in a derived class; otherwise, raises NotSupportedException.

ResetBindings() ResetBindings() ResetBindings() ResetBindings()

引发 ListChanged 类型的 Reset 事件。Raises a ListChanged event of type Reset.

ResetItem(Int32) ResetItem(Int32) ResetItem(Int32) ResetItem(Int32)

为位于指定位置的项引发类型为 ListChangedItemChanged 事件。Raises a ListChanged event of type ItemChanged for the item at the specified position.

SetItem(Int32, T) SetItem(Int32, T) SetItem(Int32, T) SetItem(Int32, T)

使用指定项替换指定索引处的项。Replaces the item at the specified index with the specified item.

ToString() ToString() ToString() ToString()

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

(Inherited from Object)

事件

AddingNew AddingNew AddingNew AddingNew

在将项添加到该列表之前发生。Occurs before an item is added to the list.

ListChanged ListChanged ListChanged ListChanged

当列表或列表中的项更改时发生。Occurs when the list or an item in the list changes.

显式界面实现

IBindingList.AddIndex(PropertyDescriptor) IBindingList.AddIndex(PropertyDescriptor) IBindingList.AddIndex(PropertyDescriptor) IBindingList.AddIndex(PropertyDescriptor)

有关此成员的说明,请参见 AddIndex(PropertyDescriptor)For a description of this member, see AddIndex(PropertyDescriptor).

IBindingList.AddNew() IBindingList.AddNew() IBindingList.AddNew() IBindingList.AddNew()

将新项添加到列表。Adds a new item to the list. 有关详细信息,请参阅 AddNew()For more information, see AddNew().

IBindingList.AllowEdit IBindingList.AllowEdit IBindingList.AllowEdit IBindingList.AllowEdit

获取一个值,该值指示是否可以编辑列表中的项。Gets a value indicating whether items in the list can be edited.

IBindingList.AllowNew IBindingList.AllowNew IBindingList.AllowNew IBindingList.AllowNew

获取一个值,该值指示是否可以使用 AddNew() 方法向列表中添加新项。Gets a value indicating whether new items can be added to the list using the AddNew() method.

IBindingList.AllowRemove IBindingList.AllowRemove IBindingList.AllowRemove IBindingList.AllowRemove

获取一个值,该值指示是否可以从列表中移除项。Gets a value indicating whether items can be removed from the list.

IBindingList.ApplySort(PropertyDescriptor, ListSortDirection) IBindingList.ApplySort(PropertyDescriptor, ListSortDirection) IBindingList.ApplySort(PropertyDescriptor, ListSortDirection) IBindingList.ApplySort(PropertyDescriptor, ListSortDirection)

根据 PropertyDescriptorListSortDirection 对列表进行排序。Sorts the list based on a PropertyDescriptor and a ListSortDirection. 有关此成员的完整说明,请参见 ApplySort(PropertyDescriptor, ListSortDirection)For a complete description of this member, see ApplySort(PropertyDescriptor, ListSortDirection).

IBindingList.Find(PropertyDescriptor, Object) IBindingList.Find(PropertyDescriptor, Object) IBindingList.Find(PropertyDescriptor, Object) IBindingList.Find(PropertyDescriptor, Object)

有关此成员的说明,请参见 Find(PropertyDescriptor, Object)For a description of this member, see Find(PropertyDescriptor, Object).

IBindingList.IsSorted IBindingList.IsSorted IBindingList.IsSorted IBindingList.IsSorted

有关此成员的说明,请参见 IsSortedFor a description of this member, see IsSorted.

IBindingList.RemoveIndex(PropertyDescriptor) IBindingList.RemoveIndex(PropertyDescriptor) IBindingList.RemoveIndex(PropertyDescriptor) IBindingList.RemoveIndex(PropertyDescriptor)

有关此成员的说明,请参见 RemoveIndex(PropertyDescriptor)For a description of this member, see RemoveIndex(PropertyDescriptor).

IBindingList.RemoveSort() IBindingList.RemoveSort() IBindingList.RemoveSort() IBindingList.RemoveSort()

有关此成员的说明,请参见 RemoveSort()For a description of this member, see RemoveSort()

IBindingList.SortDirection IBindingList.SortDirection IBindingList.SortDirection IBindingList.SortDirection

有关此成员的说明,请参见 SortDirectionFor a description of this member, see SortDirection.

IBindingList.SortProperty IBindingList.SortProperty IBindingList.SortProperty IBindingList.SortProperty

有关此成员的说明,请参见 SortPropertyFor a description of this member, see SortProperty.

IBindingList.SupportsChangeNotification IBindingList.SupportsChangeNotification IBindingList.SupportsChangeNotification IBindingList.SupportsChangeNotification

有关此成员的说明,请参见 SupportsChangeNotificationFor a description of this member, see SupportsChangeNotification.

IBindingList.SupportsSearching IBindingList.SupportsSearching IBindingList.SupportsSearching IBindingList.SupportsSearching

有关此成员的说明,请参见 SupportsSearchingFor a description of this member, see SupportsSearching.

IBindingList.SupportsSorting IBindingList.SupportsSorting IBindingList.SupportsSorting IBindingList.SupportsSorting

有关此成员的说明,请参见 SupportsSortingFor a description of this member, see SupportsSorting.

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.

(Inherited from Collection<T>)
IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

(Inherited from Collection<T>)
IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

将某项添加到 IList 中。Adds an item to the IList.

(Inherited from Collection<T>)
IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

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

(Inherited from Collection<T>)
IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

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

(Inherited from Collection<T>)
IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

将某项插入 IList 中指定的索引处。Inserts an item into the IList at the specified index.

(Inherited from Collection<T>)
IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

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

(Inherited from Collection<T>)
IRaiseItemChangedEvents.RaisesItemChangedEvents IRaiseItemChangedEvents.RaisesItemChangedEvents IRaiseItemChangedEvents.RaisesItemChangedEvents IRaiseItemChangedEvents.RaisesItemChangedEvents

获取一个值,该值指示项属性值更改是否会引发类型为 ListChangedItemChanged 事件。Gets a value indicating whether item property value changes raise ListChanged events of type ItemChanged. 不能在派生类中重写此成员。This member cannot be overridden in a derived class.

扩展方法

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

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.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个节点的上级。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个节点的上级。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子代节点的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

返回源集合中每个元素和文档的子元素的集合。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

返回源集合中经过筛选的每个元素和文档的子元素集合。Returns a filtered collection of the child elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

返回节点集合(其中包含源集合中的所有节点),并按文档顺序排列。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子节点集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

将源集合中的每个节点从其父节点中移除。Removes every node in the source collection from its parent node.

适用于

另请参阅