zoukankan
html css js c++ java
IList Webservice 序列化
using
System;
using
System.Collections;
using
System.Web;
using
System.Web.Services;
using
System.Web.Services.Protocols;
using
System.Xml.Serialization;
[WebService(Namespace
=
"
http://tempuri.org/
"
)]
[WebServiceBinding(ConformsTo
=
WsiProfiles.BasicProfile1_1)]
public
class
Service : System.Web.Services.WebService
...
{
public
Service ()
...
{
//
Uncomment the following line if using designed components
//
InitializeComponent();
}
[WebMethod]
public
string
HelloWorld()
...
{
return
"
Hello World
"
;
}
[WebMethod]
[XmlInclude(
typeof
(Article))]
public
IList GetArticleList()
...
{
IList result
=
new
ArrayList();
for
(
int
i
=
0
; i
<
20
; i
++
)
...
{
string
title
=
string
.Format(
"
新闻标题-{0}
"
, i);
string
content
=
string
.Format(
"
新闻内容-{0}
"
, i);
DateTime time
=
DateTime.Now.AddDays(i);
result.Add(
new
Article(title, content, time));
}
return
result;
}
public
class
Article
...
{
private
string
title;
private
string
content;
private
DateTime time;
public
Article()
...
{
}
public
Article(
string
title,
string
content,DateTime time)
...
{
this
.title
=
title;
this
.content
=
content;
this
.time
=
time;
}
public
string
Title
...
{
get
...
{
return
title; }
set
...
{ title
=
value; }
}
public
string
Content
...
{
get
...
{
return
content; }
set
...
{ content
=
value; }
}
public
DateTime Time
...
{
get
...
{
return
time; }
set
...
{ time
=
value; }
}
}
}
查看全文
相关阅读:
第十八章 大浏览量系统的静态化架构设计(待续)
第十七章 Velocity优化实践(待续)
第十六章 Velocity工作原理解析(待续)
第十五章 深入分析iBatis框架之系统架构与映射原理(待续)
第十四章 Spring MVC的工作机制与设计模式(待续)
第十三章 Spring框架的设计理念与设计模式分析(待续)
第十二章 Jetty的工作原理解析(待续)
第十一章 Tomcat的系统架构与设计模式(待续)
Luogu P1137 旅行计划 【拓扑排序+Dp】By cellur925
[USACO4.1]麦香牛块Beef McNuggets By cellur925
原文地址:https://www.cnblogs.com/godwar/p/1128126.html
最新文章
Ubunu12.04 vncserver xstartup配置文件
多维数组与指针(一)
指针使用const修饰总结
gcc开启C99或C11标准支持
数组作为参数的四种声明方式
Apache Commons
IntelliJ IDEA 代码调式
Ubuntu下使用天河注意事项
量子粒子群优化算法
Mysql-5.6乱码问题
热门文章
从Eclipse里导出Android程序到手机里
计算机总线
NAT技术基本原理与应用
c++20道面试题
java递归所有文件
冒泡排序和快速排序
c/c++指针基础使用
c/c++中动态内存分配处理字符串的细节问题
第二章 大象网站架构模式(待续)
第一章 大型网站架构演化(待续)
Copyright © 2011-2022 走看看