Josh Kodroff
Josh Kodroff

Reputation: 28141

Is it possible to find usages of SomeMethod<T> for a specific type?

I need to find all usages of EditorFor<DateTime> to undo something stupid I did. Is it possible to find all usages of Method<T> for a specific T?

Even hack-y solutions would be appreciated.

Upvotes: 3

Views: 76

Answers (2)

Rytmis
Rytmis

Reputation: 32067

If you know the type of the model, you can use Structural Search:

Html.EditorFor($expr$)

Define $expr$ as an expression placeholder and the expression type as:

System.Linq.Expressions.Expression<System.Func<YourModelType, DateTime>>

And you're good to go. Unfortunately I haven't figured out a way to make the search work for less specific types -- the option Exactly this type only seems to cover inheritance, not variance.

Upvotes: 2

Nick Strupat
Nick Strupat

Reputation: 5062

You might be able to tell ReSharper to convert calls to EditorFor() to explicitly declare the generic types. Then you could do an old-fashioned text search for "EditorFor"

Upvotes: 1

Related Questions