문제

What is the best way to identify, on a NFactory parsed tree, if the current class is actually inheriting (or not) from another class?

도움이 되었습니까?

해결책

you should see if the parsed tree has any basetypes or not.

TypeDeclaration typeDeclaration = new CSharpParser().Parse("public class A:B{}").Children.OfType<TypeDeclaration>().First();
        if(typeDeclaration.ClassType==ClassType.Class && typeDeclaration.BaseTypes.Count>=1)
        {
                //this class is inherited..
        }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top