LINQ通用列表无法转换问题

时间:2016-11-20 11:19:16

标签: c# linq ienumerable

public List<Reservations> getReservations(int reservationId)
{
    return hoteldb.hotel_reservations.Where(x => x.reservation_room_desc == "sdfsfs").ToList();
}

我改变了价值观,我确保一切都很好但无济于事。

即使是下面的代码,它也没有真正起作用:

<head>

1 个答案:

答案 0 :(得分:0)

也许getReservations()应该使用类型:List<hotel_reservations>

public List<hotel_reservations> getReservations(int reservationId) 
    {
        var y = hoteldb.hotel_reservations
               .Where(x => x.reservation_room_desc == "sdfsfs")
               .ToList(); 
        return y; 
    }