Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过调用 dapper.Query(...) 获得了一个动态对象。
我想在运行时添加一个成员,但我不能。我知道 ExpandoObject 但它不需要构造函数来复制所有成员。
有没有办法可以复制动态对象的所有成员,然后添加我想要的一两个字段?
-edit- 通过变通方法解决。我在 sql ( ) 中添加了一个虚拟列,select ..., '' [MyFieldName]然后将 MyFieldName 分配给我的字符串值没有问题。
select ..., '' [MyFieldName]
solved via workaround. I added a dummy column in sql (select ..., '' [MyFieldName]) then i had no problems assigning MyFieldName to my string value.