1

基本的に、SQLデータテーブルを正常に実行できる汎用リストに変換しています。しかし、リストオブジェクトを返す方法がわかりません。のバリエーションであるというエラーが表示されます-タイプSystem.Collections.Generic.IListをSystem.Collections.Generic.Listに暗黙的に変換できません

リストをタイプリストとして返す正しい方法は何でしょうか?

public List<MyObject> GetAllMyObjects()
{
    String command = "select * from names ";
    DataTable tableResult = DataTableToList.ExecuteDataTable(command, CommandType.Text, null,connectionString);

    IList<MyObject> theList = DataTableToList.ConvertTo<MyObject>(tableResult);

    return // I’m not sure how to return theList here...
}
4

1 に答える 1

7

オブジェクトを呼び出しToListますtheList

return theList.ToList();
于 2012-11-27T17:28:38.050 に答える