Saturday, September 20, 2008

Tip

Here is how to create an IDeclaredType instance from a string:

string typeName = "System.ISerializable";

IDeclarationsCache cache = PsiManager.GetInstance(solution).
GetDeclarationsCache(DeclarationsCacheScope.SolutionScope(solution, true), true);

ITypeElement typeElement = cache.GetTypeElementByCLRName(typeName);

IDeclaredType declaredType = TypeFactory.CreateType(typeElement);

No comments: