Thanks for the input guys, but the actual type of the element is not the source of our 
problem.

For the moment, ignore that I ever mentioned XmlElementAttribute... What I need to 
know is if there is any way to apply an attribute to the return parameter of a method 
generated using the Reflection.Emit classes. 

I'm guessing that the answer is no and that it was an oversight in the design of the 
ClassBuilder & MethodBuilder classes, but I was hoping that someone had discovered a 
roundabout way of achieving the same end.

Mark.

----- Original Message -----
From: "Clemens F. Vasters" <[EMAIL PROTECTED]>
Date: Monday, September 6, 2004 5:19 pm
Subject: Re: [ADVANCED-DOTNET] Emitting an attribute on a method's return parameter

> Because you are using the attribute for a different purpose than 
> it was
> designed for, you should define your own attribute class have the
> reflection code evaluate that (maybe in addition to the
> XmlElementAttribute ... || is a very easy operator to use)
> 
> -cv
> 
> > -----Original Message-----
> > From: Unmoderated discussion of advanced .NET topics.
> [ADVANCED-
> > [EMAIL PROTECTED] On Behalf Of Mark Bugeja
> > Sent: Monday, September 06, 2004 8:28 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [ADVANCED-DOTNET] Emitting an attribute on a method's
> return
> > parameter
> > 
> > I've been asked to assist with a project where they're dynamically
> > emitting web service assemblies around some existing code.
> > 
> > The XmlElementAttribute needs to be applied to webmethod return
> parameter
> > for everything to work correctly.
> > 
> > 
> > ----- Original Message -----
> > From: Thomas Tomiczek <[EMAIL PROTECTED]>
> > Date: Monday, September 6, 2004 3:05 pm
> > Subject: Re: [ADVANCED-DOTNET] Emitting an attribute on a method's
> return
> > parameter
> > 
> > > What good would this be, given that methods are not evaluated 
> by the
> > > XmlSerializer?
> > >
> > > Thomas Tomiczek
> > > THONA Software & Consulting Ltd.
> > > (Microsoft MVP C#/.NET)
> > > (CTO PowerNodes Ltd.)
> > >
> > > > -----Original Message-----
> > > > From: Unmoderated discussion of advanced .NET topics.
> > > > [EMAIL PROTECTED] On Behalf Of Mark Bugeja
> > > > Sent: Montag, 6. September 2004 04:08
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [ADVANCED-DOTNET] Emitting an attribute on a
> > > > method's return parameter
> > > >
> > > > Guys,
> > > >
> > > > I need to emit an XmlElementAttribute on the return parameter
> > > > of a method.
> > > >
> > > > Googling seems to indicate that there is a bug in the
> > > > framework preventing retrieval of the return parameter using
> > > > the MethodBuilder.DefineParameter() and that the workaround
> > > > is to emit the attribute directly on the method. In my
> > > > instance this does not work because XmlElementAttribute is
> > > > only allowed on properties and parameters and is therefore
> > > > ignored by the serializers.
> > > >
> > > > Does anyone know of a way to get an attribute onto the return
> > > > parameter using Reflect/Emit?
> > > >
> > > > Thanks,
> > > >
> > > > Mark Bugeja
> > > >
> > > > ===================================
> > > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > > > Some .NET courses you may be interested in:
> > > >
> > > > Essential .NET: building applications and components with
> > > > CSharp August 30 - September 3, in Los Angeles
> > > > http://www.develop.com/courses/edotnet
> > > >
> > > > View archives and manage your subscription(s) at
> > > > http://discuss.develop.com
> > > >
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > > Some .NET courses you may be interested in:
> > >
> > > Essential .NET: building applications and components with CSharp
> > > August 30 - September 3, in Los Angeles
> > > http://www.develop.com/courses/edotnet
> > >
> > > View archives and manage your subscription(s) at
> > > http://discuss.develop.com
> > 
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > Some .NET courses you may be interested in:
> > 
> > Essential .NET: building applications and components with CSharp
> > August 30 - September 3, in Los Angeles
> > http://www.develop.com/courses/edotnet
> > 
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> 
> ===================================
> This list is hosted by DevelopMentor�  http://www.develop.com
> Some .NET courses you may be interested in:
> 
> Essential .NET: building applications and components with CSharp
> August 30 - September 3, in Los Angeles
> http://www.develop.com/courses/edotnet
> 
> View archives and manage your subscription(s) at 
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

Essential .NET: building applications and components with CSharp
August 30 - September 3, in Los Angeles
http://www.develop.com/courses/edotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to