apply Attribute to return value

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
 
M

Mattias Sjögren

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
 
H

Hans Kesting

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top