How can I get general restrictions from CodeInterface as a CodeType object?

I am using DTE in Visual Studio 2010 to learn C # classes and automatically generate code.

When I come across a class that implements a common interface, I want to access the type of constraint as a CodeType object.

Example:

 class ServiceProviderCollection : IList<IServiceProvider> {} 

I have a CodeClass object that represents a ServiceProviderCollection . I can get the CodeInterface object for IList<IServiceProvider> using CodeClass.ImplementedInterfaces . But I don’t know how to get from there to the CodeInterface object that the IServiceProvider represents.

I can find the name of the type constraint by parsing CodeInterface.FullName and capturing the string between <and>, but this is not enough.

I use C # to implement this, if that matters.

+1
c # visual-studio-2010 code-generation envdte
source share
1 answer

Given that Microsoft is focusing on Roslyn to completely replace this model, FullName may be the only way to do this.

+1
source share

All Articles