您的查询当前使用select new {}分配匿名类型,这需要您使用var.如果要分配已知类型,请将其添加到select子句中:
IEnumerable<SomeType> query =
from RESTAURANT in db.RESTAURANTs
where RESTAURANT.REST_ID == RestID
select new SomeType { Name = RESTAURANT.name } ;
public class SomeType
{
public string Name { get; set; }
}