前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >AnonymousType匿名类型和对象之间的转换

AnonymousType匿名类型和对象之间的转换

作者头像
跟着阿笨一起玩NET
发布2018-09-18 17:54:53
1.3K0
发布2018-09-18 17:54:53
举报

本文转载:https://cloud.tencent.com/developer/article/1342418

一、匿名对象转换为对象。

1、问题:

2、解决方案:强制指定类型。

解决之。

二、 对象转换为匿名对象。

代码语言:javascript
复制
               XElement t = xmlResponResult;
                //执行API信用卡退款后返回结果。
                var refundResponse = new
                             {
                                 result = t.Element("result").Value,
                                 responsecode = t.Element("responsecode").Value,
                                 transactionID = t.Element("tranid").Value,//TransactionID
                                 authcode = t.Element("authcode").Value,
                                 item_number = t.Element("trackid").Value,//item_number
                                 merchantid = t.Element("merchantid").Value,
                                 refund_id = t.Element("udf1").Value,
                                 account_id = t.Element("udf2").Value,
                                 bill_amount = t.Element("udf3").Value,
                                 bill_currencycode = t.Element("udf4").Value
                             };
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2013-11-08 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档