public static bool InheritsFrom(this ITypeSymbol @this, ITypeSymbol other) { if (@this == null) { throw new ArgumentNullException(nameof(@this)); } if (other == null) { throw new ArgumentNullException(nameof(other)); } return(@this .BaseClasses() .Contains(other)); }
public static bool InheritsFrom(this ITypeSymbol symbol, ITypeSymbol type) { return(symbol.BaseClasses().Any(t => t.Equals(type))); }
public static IEnumerable <ITypeSymbol> AllSuperTypes(this ITypeSymbol type) { return(type.AllInterfaces.Concat(type.BaseClasses())); }