我想在我的数据库上写一个查询,找到所有长于 4 个字符的用户名并打印它们,我的代码是:
我还需要将其更改为列表/数组的某种返回类型吗?
public string[] FindNameByLength(int minimumCharNumber)
{
var query = from u in db.Users
where u.FullName.Length > minimumCharNumber
select u.FullName;
string[] namesLength;
int counter;
foreach (var s in query)
{
namesLength.Concat(new[] {s });
}
return namesLength;
}
如何将每个名称添加到数组中?