Home All Groups Group Topic Archive Search About

Remove Class Attribute with Reflection

Author
9 Jun 2006 6:44 AM
Philip Limbeck
Hi,

I am currently stuck with a problem concerning reflection.
We have to remove a Custom class attribute from an instance before
giving the instance to another subsystem. Is this possible
using Reflection ? I know one can get the Custom Attributes
by array for iteration.

Thanks in advance


--
Philip Limbeck
phil3k [at] gmx.net

Author
9 Jun 2006 12:49 PM
Cowboy (Gregory A. Beamer)
One way I have seen this solved is to create a base class without the extra
server side stuff (attributes, etc.) and cast up before throwing to the
other system. This allows you to remove a variety of things that you do not
wish to expose with minimal pain.

Can you do this with reflection? Yes and no, unless I am just not being
visionary enough (which is possible). You have the option of Reflecting,
pulling values, et al, and Emiting out a new class without the items you do
not want. This takes quite a bit more coding than the base class, however,
and I would opt for the simpler solution, as it is less buggy.

If someone comes up with a different option, we might both learn from this
one. :-)

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
Show quote
"Philip Limbeck" <phi***@gmx.net> wrote in message
news:448918be$0$590$79720d31@newsreader.inode.at...
> Hi,
>
> I am currently stuck with a problem concerning reflection.
> We have to remove a Custom class attribute from an instance before
> giving the instance to another subsystem. Is this possible
> using Reflection ? I know one can get the Custom Attributes
> by array for iteration.
>
> Thanks in advance
>
>
> --
> Philip Limbeck
> phil3k [at] gmx.net
Author
9 Jun 2006 7:26 PM
GhostInAK
Hello Philip,

I can't conceive of a situation in which you would want toremove custom attributes..
however..
If the attribute is declared as .Inherit = False then you can create a class
which inherits from your existing class but which is not decorated by the
attribute.  This of course will not work if the attribute has .Inherit =
True.

-Boo

Show quote
> Hi,
>
> I am currently stuck with a problem concerning reflection.
> We have to remove a Custom class attribute from an instance before
> giving the instance to another subsystem. Is this possible
> using Reflection ? I know one can get the Custom Attributes
> by array for iteration.
> Thanks in advance
>

AddThis Social Bookmark Button