using System.Collections.Generic; [System.Serializable] public class GameConfig { public List Cars = new List(); } class ExampleGame { private void Main() { var gameConfig = new GameConfig(); var carConfig = new CarConfig(); var componentConfig1 = new CarComponentConfig() { 部件类型名 = "前保险杠" }; var componentConfig2 = new CarComponentConfig() { 部件类型名 = "大灯" }; var componentConfig3 = new CarComponentConfig() { 部件类型名 = "尾灯" }; var component1 = new ComponentConfig() { 部件名 = "TO2018" }; var component2 = new ComponentConfig() { 部件名 = "TO2024" }; componentConfig1.车辆组件合集.Add(component1); componentConfig1.车辆组件合集.Add(component2); carConfig.车辆组件.Add(componentConfig1); carConfig.车辆组件.Add(componentConfig2); carConfig.车辆组件.Add(componentConfig3); gameConfig.Cars.Add(carConfig); } }