Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我像这样创建字段成员:
var fieldMember = new CodeMemberField("int", "Test");
现在因为字段类型是“int”,它是保留的 C# 关键字,所以生成的代码如下所示:
@int Test;
哪个不编译。
尝试使用
var fieldMember = new CodeMemberField("System.Int32", "Test");
或者
var fieldMember = new CodeMemberField(typeof(int), "Test");