I've searched here I didn't find the answer here.
How can I know if class is a abstract class from a ClassDeclarationSyntax
.
Here is my code:
public override void VisitClassDeclaration(ClassDeclarationSyntax node)
{
var className = node.Identifier.Text;
var namespaceName = (node.Parent as NamespaceDeclarationSyntax)?.Name.ToString();
var isAbastract = ??????
}
I've found the answer. here is the code:
public override void VisitClassDeclaration(ClassDeclarationSyntax node)
{
var className = node.Identifier.Text;
var namespaceName = (node.Parent as NamespaceDeclarationSyntax)?.Name.ToString();
var isAbstract = node.Modifiers.Any(x => x.IsKind(SyntaxKind.AbstractKeyword));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With