1

I am trying to get an EnvDTE.CodeTypeRef from a PropertyInfo.PropertyType.

I have tried the following

(EnvDTE.CodeTypeRef)(new CodeTypeReference(prop.PropertyType,CodeTypeReferenceOptions.GenericTypeParameter))

but get the following error message:

Running transformation: System.InvalidCastException: Unable to cast object of type 'System.CodeDom.CodeTypeReference' to type 'EnvDTE.CodeTypeRef'.

So, basically my question is how do I take a PropertyInfo.PropertyType and get an EnvDTE.CodeTypeRef from it?

famousgarkin
  • 13,687
  • 5
  • 58
  • 74
  • 1
    You cannot get `EnvDTE.CodeTypeRef` from a `PropertyInfo.PropertyType` because they are two different frameworks. The first is the API of visual studio which parses and exposes code in Visual Studio at design time. The latter is reflection and executes at runtime. – Jay Jul 17 '13 at 23:21

0 Answers0