我有以下代码,它是表单中的私有方法,可以从表单中检索所有上下文菜单。我觉得,它并不像它应该的那样简洁。如有任何建议,我将不胜感激。private IEnumerable<ContextMenuStrip> GetContextMenus() var type = this.GetType();type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
var contextMenus = fields.Where(f
我试图使用一个字符串模型属性名列表来创建一个表单。@Html.HiddenFor(model => model.modelRecId)@Html.HiddenFor(model => model.GetType().GetProperty("modelRecId").GetValue(model, null))Templates can be used only().GetProperty(prop).<