需要清除对 linq 的一个疑问
public List<SelectListItem> GetAttributeName()
{
var attri = (from z in _entities.Attributes
select z).AsEnumerable()
.Select(z => new SelectListItem {
Text = z.AttributeName + " (" + z.AttributeType.AttributeTypeCode + ")",
Value = z.AttributeID.ToString()
});
return attri.ToList();
}
在这条线上
Text = z.AttributeName + " (" + z.AttributeType.AttributeTypeCode + ")",
输出将是..像这样..
abcd (efgh)
ijkl(mnop)
qrst(uvwx)
但我需要输出是
abcd
ijkl
qrst
efgh
mnop
uvwx
如何做到这一点..?