How can I Find out what BCL types a custom type is using its method?

Posted by dotnetdev on Stack Overflow See other posts from Stack Overflow or by dotnetdev
Published on 2010-03-19T11:51:52Z Indexed on 2010/03/19 12:21 UTC
Read the original article Hit count: 148

Filed under:

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?

© Stack Overflow or respective owner

Related posts about c#