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
targetTypeTypeThe target type.
Returns
- Type
The original
targetTypeif the check passes.
Type Parameters
TThe source type to check assignability from.
Exceptions
- ArgumentException
targetTypeis not assignable fromT.
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
Returns
- Type
The original
targetTypeif the check passes.
Exceptions
- ArgumentException
targetTypeis not assignable fromsourceType.