【发布时间】:2015-01-17 10:42:27
【问题描述】:
我正在使用实体框架(edmx 文件)在 asp.net c# 中处理 MVC。我在使用 LINQ 查询返回多个列时遇到问题。我的查询工作正常,唯一的问题是方法的返回类型。
public List<string> searchcollege(string prefix)
{
try
{
List<string> clglist = new List<string>(from a in objYaphie.TblYP_CollegeProfile
where a.SchoolName.StartsWith(prefix)
select a.CollegeId,a.SchoolName);
return clglist;
}
catch (Exception e)
{
Console.Write(e);
}
return null;
}
【问题讨论】:
-
有什么问题?
-
我想知道的是,上面代码块中方法的返回类型应该是什么。由于我从两列中检索数据,我不能使用 list
作为它的返回类型。
标签: c# asp.net-mvc model-view-controller