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.
[mailto: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

Reply via email to