How to get a System.Type from an EnvDTE.CodeTypeRef or EnvDTE.CodeClass
I have already hinted at this in a previous post, but this time it's a bit different. Sometimes it's useful to switch to a full System.Type when you're doing code-generation or general CodeModel navigation within VS in an addin or VSSDK package.
The trick is to retrieve the ITypeResolutionService from the DynamicType associated with the current project:
private ITypeResolutionService GetResolutionService() { DynamicTypeService typeService = GetService<DynamicTypeService>(); Debug.Assert(typeService != ...