请大家看看这段程序,如何在返回值中增加一个属性?

shi_hang_nk 2007-11-21 10:59:56
下面的WebService方法返回一个RetObjs类型的对象,它继承了List但增加了一个属性。
public class WebService_ReturnObject : WebService
{
public class RetObj{}
public class RetObjs : List<RetObj>
{
private int _count;
public int RecordCount
{
get { return _count; }
set { _count = value; }
}
}

[WebMethod()]
[XmlInclude(typeof(RetObjs))]
public RetObjs getRetObjs()
{
RetObjs ret = new RetObjs();
ret.RecordCount = 100;

ret.AddRange(new RetObj[] { new RetObj(), new RetObj() });
return ret;
}
}

但我在VS Studio中通过View in Browser执行的结果中没有这个属性,请问各位是什么原因,如何增加上?
<?xml version="1.0" encoding="utf-8" ?>
- <ArrayOfRetObj xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<RetObj />
<RetObj />
</ArrayOfRetObj>
...全文
82 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaojing7 2007-11-22
  • 打赏
  • 举报
回复
今天早上的目的是把沉的都up起来

12,162

社区成员

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

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