Say I have a base class B
and a derived EB
class. How can I check which base constructor each EB
's constructor calls?
Is it possible to do that via semantic model?
The code that illustrates my attempt is as follows:
var typeSymbol = semanticModel.GetDeclaredSymbol(classDeclarationSyntax);
IMethodSymbol ctor1 = typeSymbol.Constructors[0];
IMethodSymbol ctor2 = typeSymbol.Constructors[1];
I can't track any public interface (like IConstructorSymbol
) so I could cast ctor0
and ctor1
to.