jeudi 23 février 2017

TypeInfo.IsAssignableFrom in Roslyn analyzer

In my Roslyn analyzer I get Microsoft.CodeAnalysis.TypeInfo of an argument by

var argumentTypeInfo = semanticModel.GetTypeInfo(argumentSyntax.Expression);

also I have another instance of Microsoft.CodeAnalysis.TypeInfo called targetTypeInfo. Now I want to know if the type describled by targetTypeInfo is assignable from the type describled by argumentTypeInfo.

I know System.Reflection.TypeInfo has its IsAssignableFrom method, which is exactly what I want. But the convertion between the two TypeInfos is a problem. What's the correct way to get type relationships in an analyzer?





Aucun commentaire:

Enregistrer un commentaire