zoukankan      html  css  js  c++  java
  • AnonymousType匿名类型和对象之间的转换

    本文转载:http://www.cnblogs.com/dean-Wei/p/3150553.html

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

    1、问题:

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

    解决之。

     

     

     

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

                   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
                                 };

  • 相关阅读:
    eclips断点调试
    单位换算
    信息论与编码复习
    嵌入式学习笔记
    DAVINCI项目日志
    英语考试方法
    虚拟机安装Ubuntu的上网设置(有线网络和无线网络)
    重装系统必须备份的几种数据
    linux笔记
    word应用技巧
  • 原文地址:https://www.cnblogs.com/51net/p/3413775.html
Copyright © 2011-2022 走看看