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:
- I would like to find all methods in the .NET framework that return arrays;
- I would like to find all methods in the .NET framework that accept arrays as a parameter.
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.
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).