using Demo.Models; try { IcndChip icndChip = new IcndChip(); icndChip.SetProperty("Code", "1234") .SetProperty("Name", "芯片"); icndChip.Features.Execute(); // 执行所有功能 icndChip.Features .DropFeature("场频自适应功能") .Execute(); icndChip.Features.Execute("场频自适应功能"); icndChip.Formula.Compute(new FormulaExecutionContext() // 计算公式(需要调整) { }); Console.WriteLine(icndChip.GetProperty("Code")); } catch (Exception ex) { Console.WriteLine(ex); } public class IcndChip : Chip { protected override void Initialize() { Name = "ICND芯片"; Features.WithFeature("场频自适应功能", (f, m) => { Console.WriteLine($"{m.Name}调用{f.Name}"); }).WithFeature("其他功能", (f, m) => { Console.WriteLine($"{m.Name}调用{f.Name},得到属性[\"Code\"]值{m.GetProperty("Code")}"); }); } }