November Happy Hour will be moved to Thursday December 5th.

Class TypeRelater

Gets relation information about types.

Inheritance
System.Object
TypeRelater
Namespace: EPiServer.Framework.TypeScanner
Assembly: EPiServer.Framework.dll
Version: 12.0.3
Syntax
[ServiceConfiguration]
public class TypeRelater : Object

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