Catel.Fody.TypeReferenceExtensions.IsAssignableFrom C# (CSharp) Method

IsAssignableFrom() public static method

public static IsAssignableFrom ( this target, TypeReference type ) : bool
target this
type Mono.Cecil.TypeReference
return bool
        public static bool IsAssignableFrom(this TypeReference target, TypeReference type)
        {
            target = type.Module.Import(target).Resolve();

            for (var typeDefinition = type.Resolve(); !typeDefinition.Equals(target) && !typeDefinition.Interfaces.Contains(target); typeDefinition = typeDefinition.BaseType.Resolve())
            {
                if (typeDefinition.BaseType == null)
                {
                    return false;
                }
            }

            return true;
        }
        #endregion
TypeReferenceExtensions