NETCORE - 动态类型 dynamic 取值
环境:.NET6 + WebApi
控制器传参时,使用 dynamic
安装 nuget 包
Program.cs 中
//添加对象序列化程序为Newtonsoft.Json builder.Services.AddControllers().AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver(); });
代码中可以直接使用了
public Task<dynamic> PostAbilityAsync(dynamic model) { string funCode = model.funCode; string funName = model.funName; throw new NotImplementedException(); }
1
标签:string,NETCORE,dynamic,funCode,model,取值 From: https://www.cnblogs.com/1285026182YUAN/p/17505298.html