怎么样序列化对象数组

kcitwm 2003-10-16 06:47:55
1:自建了一个 可序列化类 A
2:A[] Objects=new A()[2];
3:怎么样对Objects 进行序列化,,单独对A[0]序列化可行,,但按照对单个对象的方式进行则会报错

怎么办?
...全文
76 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2003-10-16
  • 打赏
  • 举报
回复
post the detailed error messages and/or some code? or see

XML Serialization in .NET
http://www.codeproject.com/csharp/xmlserialize.asp?print=true

Contact[] aContact = new Contact[table.Count];
table.Values.CopyTo( aContact, 0 );

// Deserialize the content of the Contact array to a XML file
XmlSerializer x = new XmlSerializer( typeof(Contact[]) );
TextWriter writer = new StreamWriter( "phonebook.xml" );
x.Serialize( writer, aContact );
minajo21 2003-10-16
  • 打赏
  • 举报
回复
不明白啊

12,163

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧