Deeptechtons
Deeptechtons

Reputation: 11125

How to find all methods in the .NET framework that accept or return a specific type?

This is probably a stupid question, but I still have no answer.

I would like to know if there is a method or technique that returns all the methods in the .NET framework which accept or return a specific type.

Example:

Note: I tried the Object Explorer in Visual Studio, but it seems that's not the kind of thing I want. It takes loads of time to search through all the classes and their methods, inspecting each parameter.

Upvotes: 1

Views: 279

Answers (1)

Vlad
Vlad

Reputation: 35594

Use reflection. With the reflection you can enumerate all the classes and their methods in a single assembly (using Assembly.Load, GetTypes and then GetMethods), and get the parameter types and return type.

You can find a simplified example here (it doesn't deal with generic methods, this is a separate story; this article should be helpful).

Upvotes: 3

Related Questions