If I have a class, eg T1, and I want to know what classes in the BCL it is using, how could I do this?
I came up with this:
T1.GetType().GetMethods().Where(x => x.DeclaringType.Namespace == "System");
But this will get all methods in my custom type, but I want to look inside each Method, so I was hoping I could do something like:
T1.GetType().GetMethods().BodyTypesUsed; to check if my method uses a type like Streamwriter.
How could I achieve this?
Well, you could call
MethodBase.GetMethodBody– that would let you see the types of the local variables. I don’t know whether it would show you any “incidentally used” types though…(You can use the parameter types as well as the return types too, of course.)