Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

Refection problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
csharpula csharp - 09 Apr 2008 17:22 GMT
Hello ,
I would like to ask about the following issue:

I am activating this code after i created the InitializationAttribute
and added it above objects:

PropertyInfo[] properties = this.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
   object[] attributes =
property.GetCustomAttributes(typeof(InitializationAttribute),true);
}

I get an empty list of  object[] attributes although I have objects
which are signed with this attribute in code.
Why is that?
Thank u!
Lasse Vågsæther Karlsen - 09 Apr 2008 17:53 GMT
> Hello ,
> I would like to ask about the following issue:
[quoted text clipped - 15 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***

It is unclear what you're doing.

1. Are you marking the class with the attribute? or
2. Are you marking the properties with the attribute?

And,

3. Are you checking the "attributes" array for each iteration? or
4. Only after the last one?

It would help if you could post a short, but complete, project that
demonstrates your problem. See
http://www.yoda.arachsys.com/csharp/complete.html
for a description of what a short and complete program is.

Signature

Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.