public partial class _Default : System.Web.UI.Page
{
static int sVar = 1;
int abc = 3;
int result;
[WebMethod]
public static string AjaxGetMethod()
{
sVar = 2; //静态变量可以直接调用
_Default d = new _Default(); //如果不实例化 就不能使用result,abc
NoStaticFun nsf = new NoStaticFun(); //如果不实例化 就不能使用test
d.result = nsf.test();
d.result = d.abc;
return d.result;
}
}
public class NoStaticFun
{
public int test()
{
return 2;
}
}
在这个示例中,我进行了标注,我想和大家讨论下有什么其他更好的方法,或者这几个方法,你们是怎样应用的
Copyright © 2019- gamedaodao.com 版权所有 湘ICP备2022005869号-6
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务