For example:
... new MyClass();
... new MyClass { ... };
If I'm lucky:
... Activator.CreateInstance<MyClass>();
etc.
Any thoughts?
Right click the constructor, "Find Usages". I often create a constructor for classes even if I don't need it because of this feature.
Another way, right click on class and click "Find usages". Then click "Filter usages" (in the icon bar), "Show invocation usages". If it's grayed out, there are no invocation usages, which will probably be the case if you use
Activator.CreateInstance<MyClass>();
I found this question because I'm currently looking for a better way of doing this. No luck so far.
Select the constructor and press Shift+Alt+F12. This will show you all explicit calls to the constructor, which should include any factory methods. You can then use the same shortcut to see where they are called from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With