///web service
[OperationContract]
void Saverbuspoints(List<buspoints> listbuspoints);
////调用代码
Service1Client accServiceClient = new Service1Client();
List<buspoints> listbuspoints = new List<buspoints>();.... accServiceClient.SaverbuspointsAsync(listbuspoints);如何将泛类型传递到web service中下划线部分提示错位参数请各位高手赐教!
[OperationContract]
void Saverbuspoints(List<buspoints> listbuspoints);
////调用代码
Service1Client accServiceClient = new Service1Client();
List<buspoints> listbuspoints = new List<buspoints>();.... accServiceClient.SaverbuspointsAsync(listbuspoints);如何将泛类型传递到web service中下划线部分提示错位参数请各位高手赐教!
!
!
{
[Serializable]
public class MAX
{ }
}namespace WebService1
{
/// <summary>
///Service1 的摘要描述
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{ [WebMethod]
public string HelloWorld(List<MAX> objes)
{
return "Hello World";
}
}
}namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
localhost.Service1 k = new WindowsApplication1.localhost.Service1();
WindowsApplication1.localhost.MAX d = new WindowsApplication1.localhost.MAX();
List<WindowsApplication1.localhost.MAX> t = new List<WindowsApplication1.localhost.MAX>();
t.Add(d);
MessageBox.Show(k.HelloWorld(t.ToArray()));
} private void Form1_Load(object sender, EventArgs e)
{
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;// 注意: 如果更改此处的接口名称 "IService1",也必须更新 Web.config 中对 "IService1" 的引用。
[ServiceContract]
public interface IService1
{
//buspoints表内容
[OperationContract]
List<buspoints> GetAllBuspoints(string strname); [OperationContract]
void Saverbuspoints(buspoints listbuspoints); [OperationContract]
List<BusSite> GetAllBusSite(string strname);
}这样的特性也好用吗?!