Find member fields of a particular type in C#
<p>I'm trying to find all member fields (but not local variables) of a particular type (e.g. Widget) across a large codebase.</p>

<p>I'm using VS2005 but don't mind non-vs solutions.</p>

<p>If I were using C++ I could limit my search to header files, but that doesn't work in c#</p>

<p>I could search for "Widget m_" but that risks missing fields that haven't been named correctly.</p>

<p>Any other ideas?</p>

<p><hr /></p>

<p>Further info:</p>

<p>I have a definitive list of Widgets in my WidgetManager.  Any other class can have a pointer to a Widget.  If I delete a Widget from my WidgetManager, I want all the other pointers to that widget (wherever they might be in the solution) to be set to null.</p>

<p>A "destroyed" event is raised when a Widget is removed from my WidgetManager.  I was thinking of catching that event in all the classes that store references to Widgets, and setting their references to null when Widgets were deleted.  The point of my original question is to verify that I've found all the references.</p>

<p>If anyone can think of a Better Way then let me know.</p>
