简体   繁体   中英

.NET - Find all references of property assignment

I am using VB.NET. In Visual Studio, if I right-click a property name and click "Find All References", it searches for all instances of the property being used.

However, a property is always used either for assignment (Set method) or retrieval (Get method). Is there any way of searching for only one of these uses? eg search for all uses of the property in code where it is being assigned a value, not when the value is being retrieved.

Use the compiler to turn what you want to find into errors. Remove the setter to find all the places were it was going to be used.

With Resharper, if you simply use the "Find Results" tool, and then there is a filter icon in the results window. You can then limit the results to only "Show Write Usages".

您还可以使用Reflector浏览装配体。

Resharper (MSVS addin) has the exact feature you are looking for. Check:

ReSharper.FindUsages

or

ReSharper.FindUsagesAdvanced

in keyboard shortcuts mapping (Tools -> Options -> Keyboard) to find out what shortcut is used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM