linq to xml获取数据构造Model

yongchaochu yongchaochu 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--测试环境数据-->
<add key="Appkey" value="12337722" />
<add key="Appsecret" value="sandboxda3e9856fbb65050b45a5efef" />
<add key="Url" value="http://gw.api.tbsandbox.com/router/rest" />
<add key="SessionKey" value="" />
<!--正式环境数据-->
<add key="OnLineAppkey" value="12337722" />
<add key="OnLineAppsecret" value="0ed1394da3e9856fbb65050b45a5efef" />
<add key="OnLineUrl" value="http://gw.api.taobao.com/router/rest" />
<add key="OnLineSessionKey" value="" />
</appSettings>
</configuration>

上面是我的xml格式
 public class ConfigModel
{
public string TandBoxAppkey { get; set; }
public string TandBoxAppsecret { get; set; }
public string TandBoxUrl{get;set;}
public string TandBoxSessionKey { get; set; }
public string OnLineAppkey { get; set; }
public string OnLineAppsecret { get; set; }
public string OnLineUrl { get; set; }
public string OnLineSessionKey { get; set; }
}

上面是我定义的实体
我想通过linq to xml读取内容然后构造实体model返回
求指点
...全文
评论 2
收藏 已收藏
分享
返回顶部
yongchaochu
LINQ 8,492 成员 4,736 内容