Try our conversational search powered by Generative AI!

Class TypeRelater

Gets relation information about types.

Inheritance
System.Object
TypeRelater
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.TypeScanner
Assembly: EPiServer.Framework.dll
Version: 11.20.7
Syntax
[ServiceConfiguration]
public class TypeRelater

Constructors

TypeRelater()

Declaration
public TypeRelater()

Methods

GetDistance(Type, Type)

Returns the number of levels of inheritance that separates the a sub type frome one of it's super types. If the super type is an Interface, the distance to the implementing class is returned.

Declaration
public int GetDistance(Type type, Type subtype)
Parameters
Type Name Description
System.Type type

The super type to check the distance to.

System.Type subtype

The sub type to check the distance from.

Returns
Type Description
System.Int32

The distance between the types as a non-negative integer.

Exceptions
Type Condition
System.ArgumentException

Throws an exception if subType is not actually a sub type of the super type (can't assign instance of subType to pointer of type superType).

Extension Methods