Table of Contents

Method ThrowIfNotAssignableFrom

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

ThrowIfNotAssignableFrom<T>(Type)

Throws an ArgumentException if targetType is not assignable from T.

[Version(4, 2, 0)]
public static Type ThrowIfNotAssignableFrom<T>(this Type targetType)

Parameters

targetType Type

The target type.

Returns

Type

The original targetType if the check passes.

Type Parameters

T

The source type to check assignability from.

Exceptions

ArgumentException

targetType is not assignable from T.

ThrowIfNotAssignableFrom(Type, Type)

Throws an ArgumentException if targetType is not assignable from sourceType.

[Version(4, 2, 0)]
public static Type ThrowIfNotAssignableFrom(this Type targetType, Type sourceType)

Parameters

targetType Type

The target type.

sourceType Type

The source type to check assignability from.

Returns

Type

The original targetType if the check passes.

Exceptions

ArgumentException

targetType is not assignable from sourceType.