GetList();
[OperationContract]
List GetListData(List list);
}
// 使用下面示例中说明的数据约定将复合类型添加到服务操作。
[DataContract]
public class City
{
int seq = 0;
string cityID;
string ctiyName;
[DataMember]
public string CityID
{
get
{
return cityID;
}
set
{
cityID=value;
}
}
[DataMember]
public string CityName
{
get { return ctiyName; }
set { ctiyName = value; }
}
[DataMember]
public int Seq
{
get
{ return seq; }
set
{ seq = value; }
}
}
实现代码
GetList()
{
List list = new List();
City cc = new City();
cc.CityID = "1";
cc.CityName="北京";
cc.Seq = 3;
list.Add(cc);
City cc1 = new City();
cc1.CityID = "2";
cc1.CityName = "上海";
cc1.Seq = 4;
list.Add(cc1);
return list;
}
[WebInvoke(Method = "POST",ResponseFormat = WebMessageFormat.Json)]
public List GetListData(List list)
{
return list;
}
#endregion
}