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; }
}
}
}
查看全文
相关阅读:
【leetcode】38. Count and Say
【leetcode】132. Palindrome Partitioning II
New Concept English three (56)
New Concept English three (55)
New Concept English three (54)
listening 1
New Concept English three (53)
BEC translation exercise 4
New Concept English three (52)
MBA 工商管理课程-风险型决策方法
原文地址:https://www.cnblogs.com/godwar/p/1128126.html
最新文章
11G GI启动顺序
11G RAC环境数据库启动和关闭
python三行代码实现快速排序
12.Flask-Restful
Django中的cookie和session实现
Python上下文管理器(Context managers)
Python函数缓存
目标Python2+3
python使用C扩展
Docker 常用命令总结
热门文章
saltstack实战笔记
saltstack高效运维
【leetcode】813. Largest Sum of Averages
【leetcode】258. Add Digits
【leetcode】301. Remove Invalid Parentheses
【leetcode】23. Merge k Sorted Lists
【leetcode】447. Number of Boomerangs
【leetcode】885. Boats to Save People
【leetcode】516. Longest Palindromic Subsequence
【leetcode】394. Decode String
Copyright © 2011-2022 走看看