472,978 Members | 2,285 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,978 software developers and data experts.

Remove Class Attribute with Reflection

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
Jun 9 '06 #1
2 1943
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!
*************************************************
"Philip Limbeck" <ph****@gmx.net> wrote in message
news:44*********************@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

Jun 9 '06 #2
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
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

Jun 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Oriane | last post by:
Hi, I'm currently a method attribute which is used to check the "validity" of this method against a rule. I wrote the isValid method, to be used inside the otriginal method: For instance: //...
8
by: critter | last post by:
I am trying to get a value of a property of a class, but not an instance of the class. Using Reflection, I can find the class in my assembly, and I can find the property of my class, however, I...
6
by: Dave | last post by:
We have developed a few .NET components. The application access these components through well defined interface IOurInterface. The application list display name of each component in the dialog,...
7
by: Ben Amada | last post by:
I've created a class that I need to store in ViewState. However when I try to store it in ViewState, I get the following error: "The type 'solution.pe2' must be marked as Serializable or have a...
3
by: Dan Holmes | last post by:
If i have Class2 that is inherited by Class1, how can Class1's methods operate on Class2's assembly information? For instance: public class Component { public virtual List<ComponentInfo>...
1
by: Jared | last post by:
Hi I have been looking for a few hours and couldn't find much in these groups, so I thought I would post it here in case anybody else is trying to figure it out. I have an ascx User control...
1
by: chris.bahns | last post by:
Hello All, I am fairly new to creating custom attributes, and want to get a better feel for how they should be named. We have a class hierarchy, with a base class called "SequenceCommand". This...
1
by: hardieca | last post by:
Hi! I decorate my unfinished classes and methods with a custom TODO attribute (as in things To Do). Using reflection, I am then able to parse through my classes and output all TODOs to a list I...
1
by: BrendanC | last post by:
I'm trying to understand reflection/introspection in Python. How can I identify the the type of attribute (e.g. instance var) in a class? The following returns all the class attributes (methods and...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.