英語で読む

次の方法で共有


IListSource.GetList メソッド

定義

それ自体は IList を実装していないオブジェクトから、データ ソースに連結できる IList を返します。

public System.Collections.IList GetList ();

戻り値

オブジェクトからデータ ソースに連結できる IList

IListSource インターフェイスの実装方法を示すコード例を次に示します。 GetList を実装することで、EmployeeListSource という名前のコンポーネントによってデータ バインディングの IList が公開されます。 完全なコード一覧については、「 方法: IListSource インターフェイスを実装する」を参照してください。

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

適用対象

製品 バージョン
.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
.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

こちらもご覧ください