SomeObject record = new SomeObject(); record.value1 = 1; record.value2 = "hello"; <td><input type="checkBox" id="indicator_@record.value1_@record.value2" /><td>
创建id为“indicator_1_hello”的复选框的正确剃刀语法是什么?
尝试这种方式时,它表示该对象不包含value1_的定义(可理解),当我尝试“indicator_@record.value1 @ _ @ record.value2”时,如果遇到名为_的事件的运行时错误背景(再次,可以理解).
编辑:
作为我做过的临时解决方案:
SomeObject record = new SomeObject(); record.value1 = 1; record.value2 = "hello"; var combined = String.Format("{0}_{1}",record.value1,record.value2); <td><input type="checkBox" id="indicator_@combined" /><td>
我仍然很好奇你是否可以全部内联.