472,334 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Modifying value of custom attribute at runtime

I have a custom attribute with an "IsPresent" property with get; set
When the attribute is applied to a field of a class, IsPresent will be false
by default.
At runtime, I'll read in the custom attributes of every field in the class,
and would like
to set IsPresent to false if certain application conditions are met,
something like so:

static void ReadHeader( ref MusicHeaderInfo info )
FieldInfo[] fi = (FieldInfo[])info.GetType().GetFields();
for ( int i = 0; i < fi.Length; i++ )
MetadataAttribute[] attribs =
typeof(MetadataAttribute), false );
for ( int x = 0; x < attribs.Length; x++ )
Console.WriteLine( attribs[x].IsPresent ); // output is false
attribs[x].IsPresent = true; // change to true for testing
For testing:

MusicHeaderInfo info = new MusicHeaderInfo();
ReadHeader( ref info );
ReadHeader( ref info );

The output is always false. So even though I could change the value of the
attribute at runtime,
the changes didn't stick.

Any ideas?
Nov 17 '05 #1
0 1135

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

Similar topics

by: Stefan Mueller | last post by:
I'd like to set a variable called 'FocusIsOn' if a button got the focus. Because my button is dynamically created I do it like xelement =...
by: Martin Lapierre | last post by:
I try to make a custom CodeAccessSecurityAttribute, but hit the wall at every corner. I created a simple custom security attribute, which is...
by: Erick Shuai | last post by:
In my project, I need to use custom attribute on all assemblies. This attribute will implement some non-functional code and I want to use it on...
by: Michael Iantosca | last post by:
I have a custom attribute that I attach to certain pages in my application and I want to inspect each page request as it is made to see if the custom...
by: The Developer | last post by:
Hi All, I have a web application where I am adding a custom attribute to my ASP.NET text box control and changing value of that attribute at client...
by: Harry F. Harrison | last post by:
I get 2 compile errors on assembly attributes after creating a custom attribute. If I comment out the attribute, the errors go away. I don't get...
by: bg | last post by:
hi all, I have this: // custom attribute internal class ThingAttribute : System.Attribute { ... } enum LotsOfThing
by: prabhupr | last post by:
Hi Folks I was reading this article (http://www.dotnetbips.com/articles/displayarticle.aspx?id=32) on "Custom Attribute", written by Bipin. ...
by: Jeff Hegedus | last post by:
I have a dll that requires some configuration data. I put the configuration data in a custom configuration section in a config file that is loaded...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.