在net5中使用dynamic 时
赋值
dynamic result=new {
count=1,
user=new User()
}
使用
User user = result.user;
在net6中使用 dynamic,无法像net5中那样赋值,要不会报错 'object' does not contain a definition for 'user'
赋值
dynamic result=new ExpandoObject();
result.count = 0;
result.user = new User();
使用
User user = result.user;
本文链接:https://blog.nnwk.net/article/159
有问题请留言。版权所有,转载请在显眼位置处保留文章出处,并留下原文连接
Leave your question and I'll get back to you as soon as I see it. All rights reserved. Please keep the source and links
友情链接:
子卿全栈
全部评论