IListSource.GetList Method

Definition

Returns an IList that can be bound to a data source from an object that does not implement an IList itself.

C#
public System.Collections.IList GetList();

Returns

An IList that can be bound to a data source from the object.

Examples

The following code example demonstrates how to implement the IListSource interface. A component named EmployeeListSource exposes an IList for data binding by implementing the GetList method. For a full code listing, see How to: Implement the IListSource Interface.

C#
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;
}

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also