本期与上期类似。我收到无效的匿名类型成员错误。然而,我已经修复它并确保它与我试图提取的给定数据相匹配。
var branches = ctx.tblCodeBrokBranches.Where(comp => comp.BrokOffID == 1);
var activeBrokerLocs = branches.Select(b => new
{
b.BrokOffID.ToString(), //Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
b.BrokBranch
})
.AsEnumerable()
.Select(b => new SelectListItem
{
Value = b.BrokOffID.ToString(),
Text = b.BrokBranch
});