IListSource IListSource IListSource IListSource Interface

정의

데이터 소스에 바인딩될 수 있는 목록을 반환하는 기능을 개체에 제공합니다.Provides functionality to an object to return a list that can be bound to a data source.

public interface class IListSource
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public interface IListSource
type IListSource = interface
Public Interface IListSource
파생
특성

예제

다음 코드 예제를 구현 하는 방법에 설명 합니다 IListSource 인터페이스입니다.The following code example demonstrates how to implement the IListSource interface. 이라는 구성 요소 EmployeeListSource 노출를 IList 구현 하 여 데이터 바인딩에 GetList 메서드.A component named EmployeeListSource exposes an IList for data binding by implementing the GetList method. 전체 코드 목록을 참조 하세요. 방법: IListSource 인터페이스 구현합니다.For a full code listing, see How to: Implement the IListSource Interface.

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace IListSourceCS
{
    public class EmployeeListSource : Component, IListSource
    {
        public EmployeeListSource() {}

        public EmployeeListSource(IContainer container)
        {
            container.Add(this);
        }

        #region IListSource Members

        bool IListSource.ContainsListCollection
        {
            get { return false; }
        }

        System.Collections.IList IListSource.GetList()
        {
            BindingList<Employee>   ble = new BindingList<Employee>();

            if (!this.DesignMode)
            {
                ble.Add(new Employee("Aaberg, Jesper", 26000000));
                ble.Add(new Employee("Cajhen, Janko", 19600000));
                ble.Add(new Employee("Furse, Kari", 19000000));
                ble.Add(new Employee("Langhorn, Carl", 16000000));
                ble.Add(new Employee("Todorov, Teodor", 15700000));
                ble.Add(new Employee("Vereb�lyi, �gnes", 15700000));
            }

            return ble;
        }

        #endregion
    }
}
Imports System.ComponentModel

Public Class EmployeeListSource
    Inherits Component
    Implements IListSource

    <System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
        MyClass.New()

        'Required for Windows.Forms Class Composition Designer support
        Container.Add(Me)

    End Sub

    <System.Diagnostics.DebuggerNonUserCode()> _
    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

    End Sub

    'Component overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
    End Sub

#Region "IListSource Members"

    Public ReadOnly Property ContainsListCollection() As Boolean Implements System.ComponentModel.IListSource.ContainsListCollection
        Get
            Return False
        End Get
    End Property

    Public Function GetList() As System.Collections.IList Implements System.ComponentModel.IListSource.GetList

        Dim ble As New BindingList(Of Employee)

        If Not Me.DesignMode Then
            ble.Add(New Employee("Aaberg, Jesper", 26000000))
            ble.Add(New Employee("Cajhen, Janko", 19600000))
            ble.Add(New Employee("Furse, Kari", 19000000))
            ble.Add(New Employee("Langhorn, Carl", 16000000))
            ble.Add(New Employee("Todorov, Teodor", 15700000))
            ble.Add(New Employee("Vereb�lyi, �gnes", 15700000))
        End If

        Return ble

    End Function

#End Region

End Class

설명

일반적으로 사용이 인터페이스를 구현 하지 않는 개체에서 데이터 원본에 바인딩될 수 있는 목록을 반환 IList 자체입니다.You typically use this interface to return a list that can be bound to a data source, from an object that does not implement IList itself.

실행 타임 또는 디자이너에서 데이터에 발생할 수 있습니다 되지만 각각에 대 한 규칙입니다.Binding to data can occur at either run time or in a designer, but there are rules for each. 런타임 시 데이터는 다음 중 하나에 바인딩할 수 있습니다.At run time, you can bind to data in any of the following:

  • Array

  • 구현자 IList경우 구현자는 강력한 형식의 Item[Int32] 속성 (즉, 합니다 Type 하다는 Object).Implementer of IList, provided the implementer has a strongly typed Item[Int32] property (that is, the Type is anything but Object). 기본 구현 하 여이 수행할 수 있습니다 Item[Int32] 개인입니다.You can accomplish this by making the default implementation of Item[Int32] private. 생성 하려는 경우는 IList 는 강력한 형식의 컬렉션 규칙을 따르는에서 파생 되어야 CollectionBase합니다.If you want to create an IList that follows the rules of a strongly typed collection, you should derive from CollectionBase.

  • 구현자 ITypedList합니다.Implementer of ITypedList.

디자이너에서 바인딩할을 초기화할 수 있습니다 Component 동일한 규칙에 따라 개체입니다.In a designer, you can initialize binding to Component objects by following the same rules.

참고

구현자 IListSource 반환할 수는 IList 의 컬렉션을 포함 하는 IList 개체입니다.Implementers of IListSource can return an IList that contains a collection of IList objects.

속성

ContainsListCollection ContainsListCollection ContainsListCollection ContainsListCollection

해당 컬렉션이 IList 개체의 컬렉션인지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the collection is a collection of IList objects.

메서드

GetList() GetList() GetList() GetList()

IList를 직접 구현하지 않는 개체에서 데이터 소스에 바인딩될 수 있는 IList를 반환합니다.Returns an IList that can be bound to a data source from an object that does not implement an IList itself.

적용 대상

추가 정보