Convert a IUserTypeUsage and/or an IPredefinedTypeUsage to an IDeclaredType

How can I go about translating a "TypeUsage" object into a "IDeclaredType" object? I'm trying to see if a method's parameter is derived from EventArgs, but all of the methods I see to accomplish this (e.g. in DeclaredTypeExtensions) operate on IDeclaredType objects.

Thanks!

1 comment
Comment actions Permalink

I think what you need to do is get the parameters from the IFormalParameterList, which will give you a list of ICSharpParameterDeclaration instances. Instead of going to the ITypeUsage, you can get the DeclaredElement directly from the ICSharpParameterDeclaration.

Thanks
Matt

0

Please sign in to leave a comment.