tags:

views:

69

answers:

1

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?
}
A: 

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.

Mitchel Sellers
What are the other possibilities? If I added the SoapHeader attribute to the constructor, would it be instantiated there?
Larsenal
Potentially, the key is that the soap header, is something that comes in with the message, so it isn't instantiated with values until a method call is actually made.
Mitchel Sellers