PC Review


Reply
Thread Tools Rate Thread

apply Attribute to return value

 
 
Hans Kesting
Guest
Posts: n/a
 
      23rd Sep 2005
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


 
Reply With Quote
 
 
 
 
Mattias Sjögren
Guest
Posts: n/a
 
      23rd Sep 2005
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 Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
 
Reply With Quote
 
Hans Kesting
Guest
Posts: n/a
 
      23rd Sep 2005
Mattias Sjögren wrote:
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apply Class Attribute to OVC microsoft Microsoft Outlook 0 9th Apr 2010 04:35 PM
How to insert double line or apply attribute in Word 2007 Jan :\) Microsoft Word Document Management 7 24th Jun 2008 05:10 PM
How to insert double line or apply attribute in Word 2007 Jan :\) Windows XP General 2 23rd Jun 2008 09:26 PM
Apply custom attribute to page class without CodeBehind... Nathan Baulch Microsoft ASP .NET 0 25th Oct 2007 03:57 AM
VBA to apply a Soft Return (or Hard Return) at end of wrapped line Dennis Microsoft Word Document Management 7 14th May 2005 07:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:44 PM.