c# 加载XML文件到ArrayList动态数组中 xmlarraylistc# 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参照:http://www.cnblogs.com/yukaizhao/archive/2011/07/22/xml-serialization.html 引用,using System.Xml.Linq; 界面值--->ArrayList保存-->xml属于序列化过程xml-->ArrayList---->界面 属于反序列化过程 Arraylist里能放二维数组?只能是一维的吧... 试了一下,真的可以al.add(new string[]{"1","2","3"}); 嗯,反过来的方式不应该是反序列化过程吗?写入ArrayList中是这样的arr[0]、arr[1]、arr[2].....arr[1]:arr[2]: IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的error cs1501: no overload for method 'Element takes '0''arguments IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的error cs1501: no overload for method 'Element takes '0''arguments 麻烦看清楚,是Elements()不是Element(); IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的error cs1501: no overload for method 'Element takes '0''arguments 麻烦看清楚,是Elements()不是Element();不好意思哈,看错了这个我又哪错了? IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的error cs1501: no overload for method 'Element takes '0''arguments 麻烦看清楚,是Elements()不是Element();temStr = null; 将其清空 你到底是想用集合,还是直接放字符串里逗号分隔?如果是逗号分隔if(tempStr.Length>0){tempStr+=",";}tempStr+=nodeValue; <?xml version="1.0" encoding="utf-8"?><Configs> <Config StoreName="999"> <StoreTime>888</StoreTime> <StoreMaxCount>777</StoreMaxCount> <StoreCondition>2525</StoreCondition> </Config> <Config StoreName="528"> <StoreTime>147</StoreTime> <StoreMaxCount>1471</StoreMaxCount> <StoreCondition>1321</StoreCondition> </Config> <Config StoreName="369"> <StoreTime>258</StoreTime> <StoreMaxCount>457</StoreMaxCount> <StoreCondition>12</StoreCondition> </Config> <Config StoreName="369"> <StoreTime>258</StoreTime> <StoreMaxCount>457</StoreMaxCount> <StoreCondition>12</StoreCondition> </Config></Configs>根据这个xml文件,我是想把这 <Config StoreName="999"> <StoreTime>888</StoreTime> <StoreMaxCount>777</StoreMaxCount> <StoreCondition>2525</StoreCondition> </Config>这一个节点的信息放在arr[0] 动态数组中保存,下一个节点放在arr[1]中保存然后在arr[0]中包含StoreName、StoreTime、StoreMaxCount、StoreCondition这些信息 用户发送一个消息,用ajax和Json传递数据的代码怎么写啊? 老是找不到命名空间 c# int取值的范围 母牛生小牛的算法,欢迎大家参与 对C#的看法 c# 如何向数据库表中插入数据 关于一个C#系统问题 Spread控件自定义组合键进行黏贴 c#数组问题请教 急﹗急﹗如何實現CSDN樹形界面 C#如何处理IE11弹出的下载窗口 C# 获取 excel 单元格内行数
http://www.cnblogs.com/yukaizhao/archive/2011/07/22/xml-serialization.html
xml-->ArrayList---->界面 属于反序列化过程
只能是一维的吧...
al.add(new string[]{"1","2","3"});
写入ArrayList中是这样的arr[0]、arr[1]、arr[2].....arr[1]:arr[2]:
IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的
error cs1501: no overload for method 'Element takes '0''arguments
IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的
error cs1501: no overload for method 'Element takes '0''arguments
麻烦看清楚,是Elements()不是Element();
IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的
error cs1501: no overload for method 'Element takes '0''arguments
麻烦看清楚,是Elements()不是Element();不好意思哈,看错了这个我又哪错了?
IEnumerable<XElement> ConfigNode = Config.Element(); //Config.Element()参数为0,报错的
error cs1501: no overload for method 'Element takes '0''arguments
麻烦看清楚,是Elements()不是Element();
temStr = null; 将其清空
如果是逗号分隔
if(tempStr.Length>0)
{
tempStr+=",";
}
tempStr+=nodeValue;
<?xml version="1.0" encoding="utf-8"?>
<Configs>
<Config StoreName="999">
<StoreTime>888</StoreTime>
<StoreMaxCount>777</StoreMaxCount>
<StoreCondition>2525</StoreCondition>
</Config>
<Config StoreName="528">
<StoreTime>147</StoreTime>
<StoreMaxCount>1471</StoreMaxCount>
<StoreCondition>1321</StoreCondition>
</Config>
<Config StoreName="369">
<StoreTime>258</StoreTime>
<StoreMaxCount>457</StoreMaxCount>
<StoreCondition>12</StoreCondition>
</Config>
<Config StoreName="369">
<StoreTime>258</StoreTime>
<StoreMaxCount>457</StoreMaxCount>
<StoreCondition>12</StoreCondition>
</Config>
</Configs>根据这个xml文件,我是想把这
<Config StoreName="999">
<StoreTime>888</StoreTime>
<StoreMaxCount>777</StoreMaxCount>
<StoreCondition>2525</StoreCondition>
</Config>
这一个节点的信息放在arr[0] 动态数组中保存,下一个节点放在arr[1]中保存
然后在arr[0]中包含StoreName、StoreTime、StoreMaxCount、StoreCondition这些信息