【发布时间】:2012-07-24 23:50:34
【问题描述】:
如何在以下类中返回 FirstName 和 Surname?
public static string GetAccount(int AccountId)
{
LinqSqlDataContext contextLoad = new LinqSqlDataContext();
var q = (from p in contextLoad.MyAccounts
where p.AccountId == AccountId
select new { Name = p.FirstName, Surname = p.Surname }).Single();
return ??;
}
【问题讨论】:
-
假设您也希望返回类型正确,并且您不只是想要
return string.Format("{0} {1}",q.Name,q.Surname);
标签: c# asp.net string linq return