假设您有两个 ScriptSharp 类,如下所示:
public class Person {
public int Weight;
public Name Name;
public int Height;
}
public class Name {
public string FirstName;
public string LastName;
}
如何让 ScriptSharp 在输出 JS 中生成以下内容?
var object1 = {
weight: 0,
name: {firstname: 'fname1', lastname: 'srn1'},
height: 97
};
instead of
var object1 = {};
object1.weight = 0;
object1.height = 97;