Good day, I've been trying to get the value of inheritance class name of other inheritance class in Roslyn API.
when I'm scanning the 'Face' class, I want to get the name of "Human". like this structure, I can get the first inheritance class name by using ClassDeclaration.BaseList. I can get the name of "Head" from Face class!
But I can't access the second inheritance class(Human class). I think that there's no more tree structure in Face class.
The question point is that the way how to get 2-layer upper(or more) inheritance class name if in case of the classes are seperated.
Thank you.
Get the SemanticModel for your tree, then call GetDeclaredSymbol() with the ClassDeclarationSyntax. That'll give you the ITypeSymbol and you can look at BaseType from there. You don't want to try this with syntax only because of partial classes.