Capture Add method of System.Collections.IList

Technical questions about PostSharp Laos.

Capture Add method of System.Collections.IList

Postby jeusdi2 on Wed Apr 23, 2008 11:42 am

Hello forum,

I'm developing a framework, and I need to capture the Add method of all System.Collection.IList objects. How Can I capture them? Imagine that the Aspect attribute is "AddingCollectionItemAttribute".

Thanks for all. I will appreciate a lot some help.
jeusdi2
 
Posts: 1
Joined: Wed Apr 23, 2008 11:37 am
Full Name: Jordi Cabré
Company: None

Re: Capture Add method of System.Collections.IList

Postby gfraiteur on Thu Apr 24, 2008 7:03 pm

Hi,

You can use OnMethodInvocation and apply it to IList.Add, but you should be aware that it will ONLY hook explicit calls of this method. It would not hook, for instance List<>.Add, even if it is an implementation of that semantic.

Another limitation is that it catches only calls done in the current assembly. So not indirect calls.

Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
gfraiteur
Site Admin
 
Posts: 673
Joined: Tue Dec 18, 2007 3:09 pm
Full Name: Gael Fraiteur
Company: postsharp.org


Return to PostSharp Laos


cron