tags:

views:

135

answers:

0

In the context of a WCF service (on the server side), what is the difference between this:

[OperationBehavior()]
public string TestOperation() {

}

and this:

public string TestOperation() {

}

In other words, do the default values for each parameter in OperationBehavior already apply even when the attribute isn't put on the method at all? I am hoping the answer is yes and that there is no difference between the two.

If there is, there are some very weird implications. Namely, specifying one, but not all of the parameters will cause unexpected behavior as a result of the parameters that weren't specified taking on their default values.

The main reason I ask this is that several people (here, and here) suspect that WCF doesn't automatically clean up after itself when you do something like return an opened stream. And yet, the default value of AutoDisposeParameters in OperationBehavior is true. So, to me it seems like WCF defaults to cleaning up after itself. But, if that's not the cause, I'd like to know.