SoapHeader 字段何时在 ASMX 中实例化?
考虑以下:
public MyCustomHeader MyHeader;
public New()
{
//MyHeader is NOT instantiated
}
[SoapHeader("MyHeader")]
[WebMethod()]
public bool MyFunction()
{
//MyHeader is instantiated, but when was it instantiated?
}
Consider the following:
public MyCustomHeader MyHeader;
public New()
{
//MyHeader is NOT instantiated
}
[SoapHeader("MyHeader")]
[WebMethod()]
public bool MyFunction()
{
//MyHeader is instantiated, but when was it instantiated?
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的示例中,它将在执行
MyFunction
方法之前实例化。 因为需要标头才能执行 MyFunction 的操作。In the case of your example, it would be instantiated just prior to the execution of the
MyFunction
method. As the Header was needed to be able to perform the actions of MyFunction.