c#中webservice函数如何实现重载
在webservice中增加以下代码,一定要加在类的外面。
[WebServiceBinding(ConformsTo = WsiProfiles.None)]
然后函数是按如下方式写:增加MessageName项
[WebMethod]
public bool User_Login(string sUserId,string sHardId,string sSJ,out string ErrorMsg)
{
public bool User_Login(string sUserId,string sHardId,string sSJ,out string ErrorMsg)
{
return true;
}
[WebMethod(MessageName = "method2")]
public bool User_Login(string sUserId, string sHardId, string sSJ, string sPOS_Version,out string ErrorMsg)
{
public bool User_Login(string sUserId, string sHardId, string sSJ, string sPOS_Version,out string ErrorMsg)
{
return true;
}
[WebMethod(MessageName = "method3")]
public bool User_Login(string sUserId, string sHardId, string sSJ, string sPOS_Version,string p3,out string ErrorMsg)
{
public bool User_Login(string sUserId, string sHardId, string sSJ, string sPOS_Version,string p3,out string ErrorMsg)
{
return true;
}
本文介绍如何在C#的WebService中实现函数重载,并通过指定不同的MessageName来区分相同名称的方法,提供了具体的代码示例。
2199

被折叠的 条评论
为什么被折叠?



