本文介绍了如何在asp.net webservice中创建公共属性(get; set)并在客户端访问。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,我正在尝试这个。在asp.net webservice中。并尝试在客户端访问它。
Dear I am trying this. in asp.net webservice. and trying to access at it at client end.
public class Service1 : System.Web.Services.WebService
{
private static string _NPI=string.Empty;
public static string NPI
{
get
{
return _NPI;
}
set
{
if (!string.IsNullOrEmpty(value))
{
_NPI = value;
}
}
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public int Add(int a,int b)
{
return a + b;
}
[WebMethod]
public int Min(int a, int b)
{
return a - b;
}
}
ServiceReference1.Service1SoapClient obj = new ServiceReference1.Service1SoapClient();
int a = obj.Add(5, 8);
a = obj.Min(a, 10);
//Methods are accessible but why not i am able to get,set property.
//Please help?
谢谢
等待FOR RESPONSE?
THANKS
WAITING FOR RESPONSE?
推荐答案
这篇关于如何在asp.net webservice中创建公共属性(get; set)并在客户端访问。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!