apply Attribute to return value

  • Thread starter Thread starter Hans Kesting
  • Start date Start date
H

Hans Kesting

Hi,

For a problem I'm having a solution could be to apply the SoapAttributeAttribute
to the return value of my method. The documentation says it's possible, even the
errormessage I'm getting ("Attribute 'SoapAttribute' is not valid on this declaration type.
It is valid on 'property, field, param, return' declarations only") says so.

So the question is: *how* can I specify this attribute for a return value (or parameter)?
(I know how to do it for a property or field).

BYW, I got the errormessage (from the compiler) when I specified that attribute
before the method, as in:
[SoapAttribute]
public MyObject MyMethod() ...

Hans Kesting
 
Hans,
So the question is: *how* can I specify this attribute for a return value (or parameter)?
(I know how to do it for a property or field).

BYW, I got the errormessage (from the compiler) when I specified that attribute
before the method, as in:
[SoapAttribute]
public MyObject MyMethod() ...


[return: SoapAttribute]
public MyObject MyMethod() ...


Mattias
 
Mattias said:
Hans,
So the question is: *how* can I specify this attribute for a return
value (or parameter)? (I know how to do it for a property or field).

BYW, I got the errormessage (from the compiler) when I specified
that attribute
before the method, as in:
[SoapAttribute]
public MyObject MyMethod() ...


[return: SoapAttribute]
public MyObject MyMethod() ...


Mattias

Thanks, that compiles. It's well hidden in the documentation (MSDN),
I've finally found it in the language specs (part 17.2).

Now I need to see if this solves my original problem ...

Hans Kesting
 
Back
Top