这是我必须获取认证列表的代码。我还想添加单词“全部”到列表中。我会怎么做?当我在声明结尾尝试+ "ALL"
时,它不起作用。将自定义选项添加到查看包列表
ViewBag.CertificationList = (from r in _context.INT_Certifications select r.Certification).Distinct();
这是我必须获取认证列表的代码。我还想添加单词“全部”到列表中。我会怎么做?当我在声明结尾尝试+ "ALL"
时,它不起作用。将自定义选项添加到查看包列表
ViewBag.CertificationList = (from r in _context.INT_Certifications select r.Certification).Distinct();
我还想添加单词 “全部” 列表
我要牵着你的字在这里:)试试这个:
List<string> res = (from r in _context.INT_Certifications select r.Certification).Distinct().ToList();
res.Add(" All");
ViewBag.CertificationList = res;
当我在语句结尾处尝试+“ALL”时,它不起作用。
因为你试图连接一string
到IEnumerable<string>
IEnumerable<string>
不知道+
操作。如果你想在一个字符串中枚举的元素,你可以像这样变形:
string allItems = String.Join(" ", ViewBag.CertificationList) + " All";
这是什么意思'它不工作? –
我们帮助你的政府吗? ;) –
是的;)我们很感谢 –