Is Derived Type Recursive using Roslyn - CSharp Microsoft.CodeAnalysis

CSharp examples for Microsoft.CodeAnalysis:Roslyn

Description

Is Derived Type Recursive using Roslyn

Demo Code


using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis;

public class Main{
        private static bool IsDerivedTypeRecursive(ITypeSymbol derivedType, ITypeSymbol type)
        {// www  . j  a va2s. c om
            if (derivedType == type) return true;
            if (derivedType.BaseType == null) return false;

            return IsDerivedTypeRecursive(derivedType.BaseType, type);
        }
}

Related Tutorials