This project is read-only.

Fields referenced by methods

Jun 10, 2008 at 2:43 PM
I would like to determine for a given class field, if a given method references that field or not.  Can someone give me a kickstart on doing that?

Thanks!
Jun 12, 2008 at 11:51 AM

In Reflector you can select the field, Tools > Analyzer, expand Used By and it will list the methods referencing that field.

Using the add-in API you can iterate over all assemblies in IAssemblyManager.Assemblies, then iterate over all types, all methods and all instructions within each method. If any of those contains an IFieldReference as IInstruction.Value compare the fields.


benfulton wrote:
I would like to determine for a given class field, if a given method references that field or not.  Can someone give me a kickstart on doing that?

Thanks!



Jun 12, 2008 at 2:20 PM
I see - I didn't realize that IInstruction.Value could be an IFieldReference.  Thanks!